<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ramon Ordiales Plaza</title>
    <description>The latest articles on DEV Community by Ramon Ordiales Plaza (@ramoneeza).</description>
    <link>https://dev.to/ramoneeza</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F288090%2F1f5dbfa1-1b34-4ab4-ae0a-6c6fc7e6d980.png</url>
      <title>DEV Community: Ramon Ordiales Plaza</title>
      <link>https://dev.to/ramoneeza</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ramoneeza"/>
    <language>en</language>
    <item>
      <title>Rop.Results9 is a result/error discriminated union for .NET9</title>
      <dc:creator>Ramon Ordiales Plaza</dc:creator>
      <pubDate>Mon, 07 Oct 2024 11:02:31 +0000</pubDate>
      <link>https://dev.to/ramoneeza/ropresults9-is-a-resulterror-discriminated-union-for-net9-304k</link>
      <guid>https://dev.to/ramoneeza/ropresults9-is-a-resulterror-discriminated-union-for-net9-304k</guid>
      <description>&lt;p&gt;Rop.Results9 is a library designed to return either a specific result or an error from an operation avoiding the need to use exceptions.&lt;/p&gt;

&lt;p&gt;It is available as a Nuget package as &lt;em&gt;Rop.Results9&lt;/em&gt; and the source code is available on github at &lt;a href="https://github.com/ramoneeza/Rop.Results9" rel="noopener noreferrer"&gt;Rop.Results9&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Results can be of 3 types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;VoidResult: Where only success or error in the operation is returned&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Result: Where error or a specific result of type T is returned&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;EnumerableResult&amp;lt;T&amp;gt;: Where error or an enumerable result of type T is returned&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This library use implicit operators, it is not necessary to cast in the return, the result is simply returned normally, or the corresponding error is sent&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public Result&amp;lt;int&amp;gt; Divide1(int dividend, int divisor)
{
  if (divisor == 0)
  {
    return Error.Fail("Cannot divide by zero.");
  }
  else
  {
    return dividend / divisor;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To process this result, there are several ways to do it. The most direct way is to check if the result has failed and send the error upwards, otherwise use the returned value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public VoidResult ShowDivide2(int divident,int divisor)
{
  var result = Divide1(divident, divisor);
  if (result.IsFailed)
    return result;
  Console.WriteLine($"The result is {result.Value!}");
  return VoidResult.Ok;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also map the result between a correct value and an error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public VoidResult ShowDivide(int divident,int divisor)
{
  var result = Divide1(divident, divisor);
  return result.Map(
            v =&amp;gt; Console.WriteLine($"The result is {v}"),
            e =&amp;gt; Console.WriteLine($"Error: {e.Value}")
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The library is very complete and includes several possible scenarios. The documented code is on GitHub, but here is a brief summary:&lt;/p&gt;

&lt;h2&gt;
  
  
  Classes:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;CancelError: Represents an error that occurs when an operation is cancelled.&lt;/li&gt;
&lt;li&gt;CastError: Represents an error that occurs when an operation is not castable.&lt;/li&gt;
&lt;li&gt;EmptyError: Represents an error that occurs when the result value is empty.&lt;/li&gt;
&lt;li&gt;Error: Represents an error in the result object.&lt;/li&gt;
&lt;li&gt;Error: Represents an error object with a data associated.&lt;/li&gt;
&lt;li&gt;ExceptionError: Represents an error that occurred due to an exception.&lt;/li&gt;
&lt;li&gt;FailError: Represents an error that occurs when an operation fails.&lt;/li&gt;
&lt;li&gt;MultiError: Represents an error that contains multiple errors.&lt;/li&gt;
&lt;li&gt;NotEnumerableError: Represents an error that occurs when an operation is not enumerable.&lt;/li&gt;
&lt;li&gt;NullError: Represents an error that occurs when the result value is null.&lt;/li&gt;
&lt;li&gt;TimeOutError: Represents an error due to a timeout.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;UnknownError: Represents an unknown error.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Result: Static class containing various methods for working with Result&amp;lt;T&amp;gt; objects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Result&amp;lt;T&amp;gt;: Represents a result with a value that can either be successful or contain an error.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;EnumerableResult&amp;lt;A&amp;gt;: Represents a result of an operation that returns an enumerable value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ResultHelper: A static class containing extension methods for the Result&amp;lt;T&amp;gt; class.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;VoidResult: Represents a result that does not contain a value. But can be successful or failed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  IResult Interface
&lt;/h2&gt;

&lt;p&gt;Represents the result of an operation that can either succeed or fail.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Properties&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error: Gets the error associated with this instance, if any.&lt;/li&gt;
&lt;li&gt;IsFailed: Gets a value indicating whether this instance is fail.&lt;/li&gt;
&lt;li&gt;IsFailedAndNotNull: Gets a value indicating whether this instance is failed and a null value is not the cause.&lt;/li&gt;
&lt;li&gt;IsNull: Gets a value indicating whether this instance is null.&lt;/li&gt;
&lt;li&gt;IsOk: It is an alias for IsSuccessful&lt;/li&gt;
&lt;li&gt;IsOkOrNull: Returns true if the result is successful or null.&lt;/li&gt;
&lt;li&gt;IsSuccessful: Gets a value indicating whether this instance is successful.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Methods&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GetObjectValueOrDefault(): Directly returns the value of the result as an object.&lt;/li&gt;
&lt;li&gt;ThrowIfFailed(): Throws an exception if this instance is fail.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Result&amp;lt;T&amp;gt; Class
&lt;/h2&gt;

&lt;p&gt;Represents a result with a value that can either be successful or contain an error.&lt;/p&gt;

&lt;p&gt;The Result&amp;lt;T&amp;gt; type exposes the following members.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Constructors&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Result(T): Initializes a new instance of the Result class with a value.&lt;/li&gt;
&lt;li&gt;Result(Error): Initializes a new instance of the Result&amp;lt;T&amp;gt; class with an error.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Properties&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error: Gets the error value.&lt;/li&gt;
&lt;li&gt;Value: Gets the result value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Methods&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AsEnumerable&amp;lt;A&amp;gt;(): Converts the result to an enumerable result.&lt;/li&gt;
&lt;li&gt;Deconstruct(ref T, ref Error): Deconstructs the result into its value and error.&lt;/li&gt;
&lt;li&gt;Equals(Object): Determines whether this result is equal to an object.&lt;/li&gt;
&lt;li&gt;Equals(Result&amp;lt;T&amp;gt;): Determines whether this result is equal to another result.&lt;/li&gt;
&lt;li&gt;Equals(T): Determines whether this result value is equal to another value.&lt;/li&gt;
&lt;li&gt;Execute(Action&amp;lt;T&amp;gt;): Executes an action ;&lt;/li&gt;
&lt;li&gt;Execute(Func&amp;lt;T,Boolean&amp;gt;): Executes an action if the result is successful. If the action throws an exception or returns false, the result is an error.&lt;/li&gt;
&lt;li&gt;Execute(Func&amp;lt;T,VoidResult&amp;gt;): Executes an action if the result is successful. If the action throws an exception the result is an error. Otherwise, the result is the result of the action.&lt;/li&gt;
&lt;li&gt;FromError(Error): Creates a new instance of the Result&amp;lt;T&amp;gt; class with the specified error.&lt;/li&gt;
&lt;li&gt;FromValue(T): Creates a new instance of the Result&amp;lt;T&amp;gt; class with the specified value.&lt;/li&gt;
&lt;li&gt;GetObjectValueOrDefault(): Protected method to get the object value or null.&lt;/li&gt;
&lt;li&gt;IfFailed(T): Alias for ValueOrDefault&lt;/li&gt;
&lt;li&gt;IfFailed(Func&amp;lt;Error,T&amp;gt;): Returns a successful result with the specified function in case of isfailed.&lt;/li&gt;
&lt;li&gt;Map&amp;lt;B&amp;gt;(Func&amp;lt;T,B&amp;gt;): Executes an scalar function if the result is successful.&lt;/li&gt;
&lt;li&gt;Map&amp;lt;B&amp;gt;(B): Maps the result value to a new result value.&lt;/li&gt;
&lt;li&gt;Map(Action&amp;lt;T&amp;gt;, Func&amp;lt;Error,Error&amp;gt;): Maps the result value to a new voidresult value.&lt;/li&gt;
&lt;li&gt;Map(Action&amp;lt;T&amp;gt;, Action&amp;lt;Error&amp;gt;): Maps the result value to a new voidresult value.&lt;/li&gt;
&lt;li&gt;MapEnumerable&amp;lt;A&amp;gt;(Func&amp;lt;T,IEnumerable&amp;lt;A&amp;gt;&amp;gt;): Executes an scalar function that returns an ienumerable if the result is successful.&lt;/li&gt;
&lt;li&gt;MapFailed(T): Returns a successful result with the specified value in case of isfailed.&lt;/li&gt;
&lt;li&gt;Match&amp;lt;B&amp;gt;(Func&amp;lt;T,B&amp;gt;, Func&amp;lt;Error,B&amp;gt;): Matches the result value to a new value or error.&lt;/li&gt;
&lt;li&gt;Match&amp;lt;B&amp;gt;(Func&amp;lt;T,B&amp;gt;, B): Matches the result value to a new value.&lt;/li&gt;
&lt;li&gt;Match&amp;lt;B&amp;gt;(B, B): Matches the result value to a new value.&lt;/li&gt;
&lt;li&gt;TryGet(ref T): Try to get the result value.&lt;/li&gt;
&lt;li&gt;ValueOrDefault(T): Returns the result value or defaultvalue if the result is a failure.&lt;/li&gt;
&lt;li&gt;ValueOrThrow(): Gets the result value or throws an exception if the result is a failure or null.&lt;/li&gt;
&lt;li&gt;WithError(Error): Instantiates a new result with the specified error.&lt;/li&gt;
&lt;li&gt;WithValue(T): Instantiates a new result with the specified value.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  EnumerableResult&lt;a&gt; Class
&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Represents a result of an operation that returns an enumerable value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Constructors&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;EnumerableResult(IEnumerable&amp;lt;A&amp;gt;): Creates a new instance of the EnumerableResult&amp;lt;A&amp;gt; class with the specified ienumerable value.&lt;/li&gt;
&lt;li&gt;EnumerableResult(A, params A[]): Creates a new instance of the EnumerableResult&amp;lt;A&amp;gt; class with params items&lt;/li&gt;
&lt;li&gt;EnumerableResult(Error): Creates a new instance of the EnumerableResult&amp;lt;A&amp;gt; class with the specified error.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Properties&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IsEmpty: EnumerableResult is empty.&lt;/li&gt;
&lt;li&gt;IsFailedOrEmpty: EmumerableResult is failed or empty.&lt;/li&gt;
&lt;li&gt;IsNullOrEmpty: Alias for IsFailedOrEmpty&lt;/li&gt;
&lt;li&gt;Value: Gets the result value as a read-only list.&lt;/li&gt;
&lt;li&gt;Error: Gets the error value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Methods&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AsEnumerable(): Converts the result to an enumerable.&lt;/li&gt;
&lt;li&gt;AsReadOnlySpan: Converts the enumerable result to a read-only span.&lt;/li&gt;
&lt;li&gt;Deconstruct(ref IReadOnlyList&amp;lt;A&amp;gt;, ref Error): Decomposes the result into a value and an error.&lt;/li&gt;
&lt;li&gt;Equals(Object): Determines whether the specified object is equal to the current object.&lt;/li&gt;
&lt;li&gt;Equals(EnumerableResult&amp;lt;A&amp;gt;): Determines whether two EnumerableResults are equal.&lt;/li&gt;
&lt;li&gt;Equals(IEnumerable&amp;lt;A&amp;gt;): Determines whether this EnumerableResult is equal to an IEnumerable.&lt;/li&gt;
&lt;li&gt;Execute(Action&amp;lt;IReadOnlyList&amp;lt;A&amp;gt;&amp;gt;): Executes the specified action if the result is successful.&lt;/li&gt;
&lt;li&gt;Execute(Func&amp;lt;IReadOnlyList&amp;lt;A&amp;gt;,VoidResult&amp;gt;): Executes the specified function if the result is successful.&lt;/li&gt;
&lt;li&gt;Execute(Func&amp;lt;IReadOnlyList&amp;lt;A&amp;gt;,Boolean&amp;gt;): Executes the specified function if the result is successful.&lt;/li&gt;
&lt;li&gt;ExecuteScalar&amp;lt;T&amp;gt;(Func&amp;lt;IReadOnlyList&amp;lt;A&amp;gt;,T&amp;gt;): Executes the specified scalar function if the result is successful.&lt;/li&gt;
&lt;li&gt;First(Func&amp;lt;A,Boolean&amp;gt;): Returns the first item that matches the specified function if the result is successful.&lt;/li&gt;
&lt;li&gt;First(): Returns the first item if the result is successful.&lt;/li&gt;
&lt;li&gt;FirstOrDefault(Func&amp;lt;A,Boolean&amp;gt;): Returns the first item that matches the specified function if the result is successful otherwise returns default value.&lt;/li&gt;
&lt;li&gt;FirstOrDefault(): Returns the first item if the result is successful otherwise returns default value.&lt;/li&gt;
&lt;li&gt;ForEach(Action&amp;lt;A&amp;gt;): Executes the specified action for each item in the result value if the result is successful.&lt;/li&gt;
&lt;li&gt;FromError(Error): Creates a new instance of the EnumerableResult&amp;lt;A&amp;gt; class with the specified error.&lt;/li&gt;
&lt;li&gt;FromResult(Result&amp;lt;IEnumerable&amp;lt;A&amp;gt;&amp;gt;): Converts a Result of an IEnumerable to a EnumerableResult&amp;lt;A&amp;gt;.&lt;/li&gt;
&lt;li&gt;FromValue(IEnumerable&amp;lt;A&amp;gt;): Creates a new instance of the EnumerableResult&amp;lt;A&amp;gt; class with the specified ienumerable value.&lt;/li&gt;
&lt;li&gt;FromValue(A): Creates a new instance of the EnumerableResult&amp;lt;A&amp;gt; class with the specified single value.&lt;/li&gt;
&lt;li&gt;GetObjectValueOrDefault(): protected override object GetObjectValueOrDefault()&lt;/li&gt;
&lt;li&gt;IfFailed(Func&amp;lt;Error,IReadOnlyList&amp;lt;A&amp;gt;&amp;gt;): Converts the result to a list, or given a function to convert the error.&lt;/li&gt;
&lt;li&gt;Map&amp;lt;T&amp;gt;(Func&amp;lt;IReadOnlyList&amp;lt;A&amp;gt;,IEnumerable&amp;lt;T&amp;gt;&amp;gt;): Maps the result value to a new result value using a function.&lt;/li&gt;
&lt;li&gt;Map&amp;lt;T&amp;gt;(Func&amp;lt;A,T&amp;gt;): Maps each item using the specified function foreach item if the result is successful.&lt;/li&gt;
&lt;li&gt;Map(Action&amp;lt;IReadOnlyList&amp;lt;A&amp;gt;&amp;gt;, Func&amp;lt;Error,Error&amp;gt;): Maps the result value to a new voidresult value.&lt;/li&gt;
&lt;li&gt;Map(Action&amp;lt;IReadOnlyList&amp;lt;A&amp;gt;&amp;gt;, Action&amp;lt;Error&amp;gt;): Maps the result value to a new voidresult value.&lt;/li&gt;
&lt;li&gt;Map&amp;lt;B&amp;gt;(B): Maps the successful result to a new result using the specified value;&lt;/li&gt;
&lt;li&gt;Match&amp;lt;B&amp;gt;(Func&amp;lt;IReadOnlyList&amp;lt;A&amp;gt;,B&amp;gt;, Func&amp;lt;Error,B&amp;gt;): Matches the result value to a new value or error using two functions.&lt;/li&gt;
&lt;li&gt;Match&amp;lt;B&amp;gt;(Func&amp;lt;A,B&amp;gt;, Func&amp;gt;Error,IReadOnlyList&amp;lt;B&amp;gt;&amp;gt;): Matches the result value to a new list value using a foreach function or error using a list function.&lt;/li&gt;
&lt;li&gt;MatchOrNull: Returns the result value or null if the result is a failure.&lt;/li&gt;
&lt;li&gt;Select&amp;lt;B&amp;gt;(Func&amp;lt;A,B&amp;gt;): Alias for Map. Selects each item using the specified function if the result is successful.&lt;/li&gt;
&lt;li&gt;ToArray(): Converts the result to an array.&lt;/li&gt;
&lt;li&gt;ToList(): Converts the result to a list.&lt;/li&gt;
&lt;li&gt;ValueOrThrow(): Gets the result value or throws an exception if the result is a failure.&lt;/li&gt;
&lt;li&gt;Where(Func&amp;lt;A,Boolean&amp;gt;): Filters the items using the specified function if the result is successful.&lt;/li&gt;
&lt;li&gt;WithError(Error): Initializes a new instance of the EnumerableResult&amp;lt;A&amp;gt; class with the specified error.&lt;/li&gt;
&lt;li&gt;WithValue(IEnumerable&amp;lt;A&amp;gt;): Initializes a new instance of the EnumerableResult&amp;lt;A&amp;gt; class with the specified value.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;This post was also published on &lt;a href="https://medium.com/@ramon_12434/rop-results9-is-a-result-error-discriminated-union-for-net9-48ccad06a475" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;. &lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>csharp</category>
      <category>netcore</category>
      <category>net9</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Icon Banks for Winforms and .NET9</title>
      <dc:creator>Ramon Ordiales Plaza</dc:creator>
      <pubDate>Fri, 04 Oct 2024 07:53:48 +0000</pubDate>
      <link>https://dev.to/ramoneeza/icon-banks-for-winforms-and-net9-29n</link>
      <guid>https://dev.to/ramoneeza/icon-banks-for-winforms-and-net9-29n</guid>
      <description>&lt;p&gt;I have just uploaded a new complete refactoring of the Icon Bank for Winforms. In this refactoring, I use advanced features of both Winforms and .NET9&lt;/p&gt;

&lt;p&gt;The libraries are named like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Rop.winforms9.DuotoneIcons.xxx&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Where xxx represent the Icon Bank that it contains.&lt;/p&gt;

&lt;p&gt;At the moment there are only two Icon Banks available:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rop.Winforms9.DuotoneIcons.MaterialDesign&lt;/li&gt;
&lt;li&gt;Rop.Winforms9.DuotoneIcons.GoogleMaterial&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both banks are duotone icons. Although in the case of the Material Design bank they can also be used as single color.&lt;/p&gt;

&lt;p&gt;The icons in the library are loaded into an IEmbeddedIcons structure.&lt;/p&gt;

&lt;p&gt;Thy can be accessed programmatically using the IconRepository class as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;IEmbeddedIcons myicons=IconRepository.GetEmbeddedIcons&amp;lt;MaterialDesignIcons&amp;gt;();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The IEmbeddedIcons structure is defined as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public interface IEmbeddedIcons
{
    string FontName { get; }
    IReadOnlyList&amp;lt;string&amp;gt; Codes { get; }
    IReadOnlyList&amp;lt;string&amp;gt; Aliases { get; }
    Size BaseSize { get; }
    int Count { get; }
    DuoToneIcon? GetIcon(string name);
    float DrawIcon(Graphics gr, string code, DuoToneColor iconcolor, float x, float y, float height);
    float DrawIconBaseLine(Graphics gr, string code, DuoToneColor iconcolor, float x, float baseline, float height);
    void DrawIconFit(Graphics gr, string code, DuoToneColor iconcolor, float x, float y, float width);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Icons can be drawn directly using 3 procedures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;DrawIcon()&lt;/em&gt; which draws an icon at position x, y with the size defined by its height.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;DrawIconBaseLine()&lt;/em&gt; which draws an icon at position x, baseline with the size defined by its height.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;DrawIconFit()&lt;/em&gt; which draws an icon at position x, y with a size adjusted to a grid width x width.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In addition to the direct drawing of icons, several controls are included:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;IconLabel&lt;/em&gt;: This is a label control that includes an icon and a text.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;SoloIconLabel&lt;/em&gt;: This is a label control that only includes an icon.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;IconBoolLabel&lt;/em&gt;: This is a label control that displays an icon and a different text in different colors based on a boolean value.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;SoloIconBoolLabel&lt;/em&gt;: This is a label control that displays a different icon in different colors based on a boolean value.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;IconIndexLabel&lt;/em&gt;: This is a label control that displays a different icon and text based on an integer value.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;SoloIconIndexLabel&lt;/em&gt;: This is a label control that displays a different icon based on an integer value.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;IconButton&lt;/em&gt;: This is a button that includes an icon and text.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;SoloIconButton&lt;/em&gt;: This is a button that only includes an icon.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;IconBoolButton&lt;/em&gt;: This is a button that displays a different icon and text in different colors based on a boolean value.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;SoloIconBoolButton&lt;/em&gt;: This is a button that displays a different icon in different colors based on a boolean value.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;IconIndexButton&lt;/em&gt;: This is a button that displays a different icon and text based on an integer value.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;SoloIconIndexButton&lt;/em&gt;: This is a button that displays a different icon based on an integer value.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;SwitchIcon&lt;/em&gt;: This is a modern switch control.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;ColumnPanel&lt;/em&gt;: This is a column panel to indicate the ordering of a list.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Github Repository
&lt;/h2&gt;

&lt;p&gt;In addition to the ready-to-use Nuget libraries, in the &lt;a href="https://github.com/ramoneeza/Rop.Winforms9.Icons" rel="noopener noreferrer"&gt;Github Repository&lt;/a&gt; corresponding to this icon bank suite, there is an &lt;strong&gt;Icon Browser&lt;/strong&gt;, which is used to quickly locate the available icons and a &lt;strong&gt;Builder&lt;/strong&gt; that allows you to create or increase the icon banks currently available.&lt;br&gt;
Along with these two utilities… an example of use and employment of “&lt;strong&gt;Partial Controls&lt;/strong&gt;” to generate new controls based on AOP (&lt;em&gt;Aspect Oriented Programming&lt;/em&gt;)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsj492wr16k33ubpm11q9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsj492wr16k33ubpm11q9.png" alt="Icon Browser"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwnc9lgitoluf4ysasmtw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwnc9lgitoluf4ysasmtw.png" alt="Builder"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If anyone is interested in the changes in Winforms application programming in .NET9, in future posts I will indicate how to modernize the creation of custom controls in Winforms according to the new possibilities of .NET9.&lt;/p&gt;

&lt;p&gt;Remain listening…&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This article was also published via &lt;a href="https://medium.com/@ramon_12434/icon-banks-for-winforms-and-net9-fcf2230a7259" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>csharp</category>
      <category>winforms</category>
      <category>net9</category>
      <category>netcore</category>
    </item>
  </channel>
</rss>
