c# reflection create generic type
Type generic = typeof(Dictionary<,>);
// Create an array of types to substitute for the type parameters of Dictionary. The key is of type string, and the type to be contained in the Dictionary is Test.
Type[] typeArgs = { typeof(string), typeof(Test) };
// Create a Type object representing the constructed generic type.
Type constructed = generic.MakeGenericType(typeArgs);
var instance = Activator.CreateInstance(constructedType);if (typeof(T) == typeof(String)) return (T)(object)String.Empty;
Also in C#:
- how to detect if a key is pressed in c#
- c sharp substring
- formula calculating distance coordinates latitude longitude c#
- c# null conditional
- c# asp.net hover tooltip
- visual studio C# hintergrund bild ändern
- unity transformer double en float
- How to get the world position of the edge of an object?
- c# reflection create generic type
- unity c# write line
- c# how to take from a float
- c# keyvaluepair
- unity set material
- if statement conditions c#
- never lose focus textbox c#
- c# remove character from string at index
- redirect to https codeigniter
- chase object unity
- what type of variable is true or false in c#
- change sprite of gameobject unity
- how to create public variable in c#
- unity rotation
- declare string array c# without size
- how to add a list to observablecollection in c#