StringExtensions.AsEnum Method

Namespace:
Weavy.Core.Helpers
Assembly:
Weavy.Core.dll

AsEnum(string)

Helper method for converting a string to an enum of type TEnum.

public static TEnum? AsEnum<TEnum>(this string input)

    where TEnum : struct

Parameters

input
string

The input string to convert.

Returns

An object of type TEnum or null if the conversion fails.