Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# convert enum to list

Enum.GetValues(typeof(SomeEnum)).Cast<SomeEnum>();
Comment

convert list string to list enum c#

public static class StringEnumerableExtensions {
    public static IEnumerable<T> StringsToEnums<T>( this IEnumerable<string> strs) where T : struct, IConvertible {
        Type t = typeof( T );

        var ret = new List<T>();

        if( t.IsEnum ) {
            T outStr;
            foreach( var str in strs ) {
                if( Enum.TryParse( str, out outStr ) ) {
                    ret.Add( outStr );
                }
            }
        }

        return ret;
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: car controller script unity 
Csharp :: unity instantiate 
Csharp :: c# array remove first element 
Csharp :: unityWebRequest get returned data 
Csharp :: move file from one folder to another c# 
Csharp :: how to check file path is valid in c# 
Csharp :: C++ in C# 
Csharp :: meta keywords tag mvc .net core 
Csharp :: c# writteline 
Csharp :: pass datatable to stored procedure c# dapper 
Csharp :: unity agent bake not derecting mesh 
Csharp :: how to set a objects position to the mouse unity 
Csharp :: unity spawn button 
Csharp :: unity set list of strings 
Csharp :: c# xpath read attribute value 
Csharp :: c# override index operator 
Csharp :: c# return list 
Csharp :: querymultiple dapper c# 
Csharp :: c# getforegroundwindow 
Csharp :: How to search for a string from readline in c# 
Csharp :: delayed function unity 
Csharp :: getname of month from date c# 
Csharp :: c# remove from list in foreach 
Csharp :: convert int to short c# 
Csharp :: .net core enum select list 
Csharp :: how to pause code execution in c# 
Csharp :: unity3d remove parent 
Csharp :: unity default cube mesh 
Csharp :: crop bitmap image c# 
Csharp :: untiy instanciate prefab 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =