Answers for "define generic list c#"

C#
3

to list c#

var arr = new int[] {1, 2, 3};
List<int> list = arr.ToList();
Posted by: Guest on June-17-2020
0

c# get list object type of generic list

Type type = pi.PropertyType;
if(type.IsGenericType && type.GetGenericTypeDefinition()
        == typeof(List<>))
{
    Type itemType = type.GetGenericArguments()[0]; // use this...
}
Posted by: Guest on October-15-2020

C# Answers by Framework

Browse Popular Code Answers by Language