public static void Main(string[] args) { OpenGenericClass <int> genericClass = new OpenGenericClass <int>(1, DoubleIt); OpenGenericClass <MyType> genericClass2 = new OpenGenericClass <MyType>(new MyType(), Identity <MyType>); Type openGenericType = typeof(OpenGenericClass <>); Type constructedGenericType = typeof(OpenGenericClass <int>); SpecificClassOfGeneric genericClass3 = new SpecificClassOfGeneric(1, DoubleIt); }
public static int Main(string[] args) { GenericClass <int> genericClass = new GenericClass <int>(1); GenericClass <MyType> genericClass2 = new GenericClass <MyType>(new MyType()); GenericTypeWithIgnore <int, MyType> genericClass3 = new GenericTypeWithIgnore <int, MyType>(); ScriptImportedGenericClass <MyType> importedGenericClass = new ScriptImportedGenericClass <MyType>(); ReferencedGenericClass <MyType> referencedGenericClass = new ReferencedGenericClass <MyType>(); bool isSame = genericClass2.Type == genericClass.Type; Type genericClassType = typeof(GenericClass <int>); int[] array = new int[] { 1, 2, 3, 4, 5 }; int[] newArr = Copy(array, 0, array.Length); Dictionary <string, object> values = new Dictionary <string, object>(); Dictionary <string, Dictionary <string, Dictionary <string, object> > > values2 = new Dictionary <string, Dictionary <string, Dictionary <string, object> > >(); Dictionary <string, object> copiedValues = CopyDictionary(values); Dictionary <string, Dictionary <string, Dictionary <string, object> > > copiedValues2 = CopyDictionary(values2); IDictionary <string, object> copiedValuesOfStrings = CopyDictionary(CopyDictionaryOfStringKeys(values)); IBulkAsyncExecutionManager <string> bem = new BulkAsyncExecutionManager <string>(); bem.AddExecutionKey(""); bem.AddExecutionKeys(new string[] { "Lol", "asdasd", "hashasd" }); bem.StartExecution(); if (bem.GetType() == typeof(BulkAsyncExecutionManager <int>)) { } if (bem.GetType() == typeof(BulkAsyncExecutionManager <string>)) { } if (typeof(IBulkAsyncExecutionManager <string>).IsAssignableFrom(bem.GetType())) { } GenericWithMultipleParams <int, bool, string> genericWithMultipleParams = new GenericWithMultipleParams <int, bool, string>(); string str = genericWithMultipleParams.ToString(); SpecificClassOfGeneric specificClassOfGeneric = new SpecificClassOfGeneric(); bool isInt = specificClassOfGeneric.Type == typeof(int); GenericClass <int> myContainer = specificClassOfGeneric.CreateContainer(); isInt = myContainer.Type == typeof(int); bool isType1 = typeof(GenericClass <>).MakeGenericType(typeof(string)) == typeof(GenericClass <string>); bool isType2 = typeof(Generic_2 <,>).MakeGenericType(typeof(string), typeof(int)) == typeof(Generic_2 <string, int>); }