<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Daniel Oliveira on Medium]]></title>
        <description><![CDATA[Stories by Daniel Oliveira on Medium]]></description>
        <link>https://medium.com/@daniel-iel?source=rss-246ef2dcb20a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DTU2qRarDuUIYTLxyZtymw.jpeg</url>
            <title>Stories by Daniel Oliveira on Medium</title>
            <link>https://medium.com/@daniel-iel?source=rss-246ef2dcb20a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 15:07:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@daniel-iel/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Simplify your string reader and writer in .net.]]></title>
            <link>https://medium.com/@daniel-iel/simplify-your-string-reader-and-writer-in-net-4c7144ec7dc0?source=rss-246ef2dcb20a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c7144ec7dc0</guid>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[Daniel Oliveira]]></dc:creator>
            <pubDate>Tue, 28 Feb 2023 20:28:14 GMT</pubDate>
            <atom:updated>2023-03-01T02:07:28.422Z</atom:updated>
            <content:encoded><![CDATA[<h3>Simplify your string reader and writer in .net.</h3><p>In the world of software development, it’s not uncommon to come across situations where you need to convert non-complex objects into manageable strings. This can be a time-consuming and error-prone process, especially when dealing with large and complex data structures. Fortunately, there are tools available to make this process easier and more efficient.</p><p>The Spinner Framework is a powerful tool that simplifies the process of converting non-complex objects into positional strings. It does this by using a customizable set of rules that allow developers to define how each object should be transformed into a string. This framework can be used in a wide range of applications, from simple data conversions to more complex serialization and deserialization tasks.</p><p>The Spinner Framework is its ease of use. The framework is designed to be easy to set up and configure, with clear documentation and examples provided to help developers get started quickly.</p><h4><strong>Installation</strong></h4><p>Spinner is distributed through the [<a href="https://www.nuget.org/packages/Spinner/">nuget</a>], compatible with <strong>.net core 3.1</strong> and <strong>.net 5, 6,</strong> and <strong>7</strong>.</p><blockquote>Install-Package Spinner</blockquote><h4><strong>Configuring an object</strong></h4><p>To configure the layout of the string that we will generate at the end of the process, we will use the <strong><em>ObjectMapper, WriteProperty,</em></strong> and <strong><em>ReadProperty </em></strong>attributes.</p><p><strong>ObjectMapper</strong>: an attribute that works as a general bound of positions, that is, if the string we are generating is longer than the sum of all values ​​contained in the <strong>length</strong> property of the <strong>WriteProperty</strong> and <strong>ReadProperty: </strong>attributes, characters that exceed the limit will be ignored.</p><pre>[ObjectMapper(length: 35)]<br>public struct Person<br>{<br> public Person(string name, string phone)<br> {<br>   this.Name = name;<br>   this.Phone = phone;<br> }<br><br> [WriteProperty(length: 20, order: 1, paddingChar: &#39; &#39;)]<br> public string Name { get; private set; }<br> <br> [WriteProperty(length: 15, order: 2, paddingChar: &#39; &#39;)]<br> public string Phone { get; private set; }<br>}</pre><p><strong>ReadProperty</strong>: an attribute that defines the position where the value starts and finishes.</p><pre>[ObjectMapper(length: 35)]<br>public struct Person<br>{<br> public Person(string name, string phone)<br> {<br>   this.Name = nome;<br>   this.Phone = phone;<br> }<br><br> [ReadProperty(start: 0, length: 19 )] <br> public string Name { get; private set; }<br><br> [ReadProperty(start: 20, length: 15 )]<br> public string Phone { get; private set; }<br>}</pre><h4><strong>Using Spinner</strong></h4><p>We can use the spinner in two ways, the first is by converting an instance of an object to a string, and the second is by converting a string into an object.</p><h4><strong>Writing a string</strong></h4><p>To convert the mapped object into a string, just call the method called <strong><em>WriteAsString</em></strong>.</p><pre>Person person = new Person(&quot;Fulano&quot;, &quot;011659888888&quot;); <br>Spinner&lt;Person&gt; spinner = new Spinner&lt;Person&gt;(person); <br>string positionalString = spinner.WriteAsString();<br>//outrput: Fulano 011659888888</pre><h4><strong>Reading a string</strong></h4><p>To convert a string into a mapped object, just call the method called <strong><em>ReadFromString</em></strong>.</p><pre>Spinner&lt;Person&gt; spinnerReader = new Spinner&lt;Person&gt;();<br>Person person = spinnerReader.ReadFromString(&quot; Fulano 011659888888&quot;);</pre><h4>Performance</h4><p>As we see in the benchmark results, the Spinner Framework is a top-performing choice for converting non-complex objects into positional strings, benchmarking has shown that it is a highly performant tool that can convert objects into positional strings with exceptional speed and accuracy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*oVchCZGepdtV-XEbRd3Cdw.png" /><figcaption>benchmark results</figcaption></figure><h4><strong>Conclusion</strong></h4><p>As we could see in this article, the spinner is a simple but very useful framework helping the writing and reading of strings.<br>For more information about Spinner, visit [<a href="https://github.com/Daniel-iel/Spinner">repository</a>] and [<a href="https://spinnerframework.com/docs/intro">documentation</a>].</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c7144ec7dc0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>