Skip to content

Converter

Taiizor edited this page Mar 1, 2023 · 12 revisions

Converter Class - Skylark.Helper Namespace

The Converter class provides methods to convert between different enumerations used in the Skylark library. The supported enumeration types are:

  • AlphabeticPasswordType (SEAPT)
  • ClearNumericType (SECNT)
  • CompressWebType (SECWT)
  • HttpWebType (SEHWT)
  • ModeStorageType (SEMST)
  • QueryDomainType (SEQDT)
  • SpecialPasswordType (SESLPT)
  • SimilarPasswordType (SESRPT)
  • StorageType (SEST)
  • TimeType (SETET)
  • TaxType (SETXT)

The Converter class contains the following methods:

  • Convert(string Type, SEST Back = SEST.Bit)
  • Convert(string Type, SEQDT Back = SEQDT.TXT)
  • Convert(string Type, SECNT Back = SHN.ClearType)
  • Convert(string Type, SEMST Back = SEMST.Toucan)
  • Convert(string Type, SETET Back = SETET.Attosecond)
  • Convert(string Type, SETXT Back = SETXT.Amount)
  • Convert(string Type, SESRPT Back = SESRPT.Jaccard)
  • Convert(string Type, SESLPT Back = SESLPT.Mixed)
  • Convert(string Type, SECWT Back = SECWT.None)
  • Check(string str1, string str2)
  • TryGetEnum<TEnum>(string value, out TEnum result)

The Check method is a private helper method that checks if a given string matches an enumeration value.

The TryGetEnum method is a generic helper method that tries to parse a string into an enumeration value of the specified type.

Example Usage

The following example demonstrates how to use the Converter class to convert a string to an enumeration value:

using Skylark.Enum;
using Skylark.Helper;

string input = "Bit"; StorageType result = Converter.Convert(input);

Console.WriteLine(result); // Outputs "Bit"

Clone this wiki locally