Types

The following types are supported as the underlying type of an Intellenum:

  • byte, sbyte, short, ushort, int, uint, long, ulong, char, string, and bool.
  • Guid, DateTime, DateTimeOffset, TimeSpan, DateOnly, TimeOnly
  • Custom types - MyCustomType

Restrictions for custom types:

  • It cannot be a collection.
  • It cannot be the same type as the enumeration itself.

Examples

[Intellenum]
          public partial class CustomerType
          {
          public static readonly CustomerType Standard = new(1);
          public static readonly CustomerType Gold = new(2);
          }
          

Specifying an underlying type

You can specify a different underlying type than the default int by using the [Intellenum(typeof(short))] or [Intellenum] attributes.

Example

[Intellenum(typeof(short))]
          public partial class CustomerType
          {
          public static readonly CustomerType Standard = new(1);
          public static readonly CustomerType Gold = new(2);
          }
          

Source:


          ## Top-Level Directory Explanations
          
          <a class='local-link directory-link' data-ref="samples/" href="#samples/">samples/</a> - This directory contains example projects demonstrating the usage of Intellenum.
          
          <a class='local-link directory-link' data-ref="samples/Intellenum.Examples/" href="#samples/Intellenum.Examples/">samples/Intellenum.Examples/</a> - Contains various example projects demonstrating different aspects of Intellenum, such as serialization, conversion, syntax examples, types, typical scenarios, and more.
          
          <a class='local-link directory-link' data-ref="samples/WebApplication/" href="#samples/WebApplication/">samples/WebApplication/</a> - Contains a sample web application that uses Intellenum.
          
          <a class='local-link directory-link' data-ref="src/" href="#src/">src/</a> - This directory contains the source code of the Intellenum library.
          
          <a class='local-link directory-link' data-ref="src/Benchmarks/" href="#src/Benchmarks/">src/Benchmarks/</a> - Contains benchmark tests for the Intellenum library.
          
          <a class='local-link directory-link' data-ref="src/Intellenum.SharedTypes/" href="#src/Intellenum.SharedTypes/">src/Intellenum.SharedTypes/</a> - Contains shared types used across the Intellenum library.
          
          <a class='local-link directory-link' data-ref="src/Intellenum/" href="#src/Intellenum/">src/Intellenum/</a> - Contains the main source code for the Intellenum library. This directory is further divided into subdirectories for diagnostics, extensions, generators, member building, properties, rules, static constructor building, templates, and more.
          
          <a class='local-link directory-link' data-ref="tests/" href="#tests/">tests/</a> - This directory contains test projects for the Intellenum library.
          
          <a class='local-link directory-link' data-ref="tests/AnalyzerTests/" href="#tests/AnalyzerTests/">tests/AnalyzerTests/</a> - Contains unit tests for the Intellenum analyzer.
          
          <a class='local-link directory-link' data-ref="tests/ConsumerTests/" href="#tests/ConsumerTests/">tests/ConsumerTests/</a> - Contains tests for consuming the Intellenum library.
          
          <a class='local-link directory-link' data-ref="tests/Intellenum.Tests/" href="#tests/Intellenum.Tests/">tests/Intellenum.Tests/</a> - Contains additional tests for the Intellenum library.
          
          <a class='local-link directory-link' data-ref="tests/SnapshotTests/" href="#tests/SnapshotTests/">tests/SnapshotTests/</a> - Contains snapshot tests for the Intellenum library.
          
          <a class='local-link directory-link' data-ref="tests/Testbench/" href="#tests/Testbench/">tests/Testbench/</a> - Contains a test bench for the Intellenum library.