// I introduce T2 in this method public string MethodWithArgument <T2>(MyGenericClass <T> myClass) { // Now, the casting is valid MyGenericClass <T, T2> mySubClass = (MyGenericClass <T, T2>)myClass; var a = mySubClass.expression; // ... I can work with expression here }
public static void Test5() { MyGenericClass <int> genericObject = new MyGenericClass <int>(); genericObject.value = 10; IMyInterface <int> genericInterface = genericObject; }
public static void Main(string[] args) { MyClass1 mc1 = MyGenericClass <MyClass1> .MyGenericMethod(); //Do something with mc1 Console.WriteLine(mc1.MyClass2Property.MyOtherStringProperty); Console.ReadLine(); }
public void TestDateConvertSuccsess() { var dateNow = DateTime.Today.Date.ToString(); MyGenericClass <string> genericClass = new MyGenericClass <string>("David"); var result = genericClass.ConvertStringToDateTime <DateTime>(dateNow); Assert.IsNotNull(result); }
static void Main(string[] args) { // OK! MyGenericClass <MyClass> c1 = new MyGenericClass <MyClass>(); // Gives the error: // 'MyClass2' must be a non-abstract type with a public parameterless // constructor in order to use it as parameter 'T' in the generic type // or method 'MyGenericClass<T>' MyGenericClass <MyClass2> c2 = new MyGenericClass <MyClass2>(); }
void Tester() { var intClass = new MyGenericClass <int>(); intClass.MyValue = 1; var stringClass = new MyGenericClass <string>(); stringClass.MyValue = "hi"; }
static void Main(string[] args) { int?nullableInt = null; Nullable <int> nInt = null; Console.WriteLine($"NullableInt value: {nullableInt}"); nInt = 1; ChangValue(nInt); Console.WriteLine("after changevalue: " + nInt); var g = new MyGenericClass <TempClass>(); var v = ChangeType <string, int>("10"); for (int i = 0; i < 10; i++) { Console.WriteLine("test string".Surprise(i)); } var o = new { Name = "test", i = 20 }; Console.WriteLine(o); for (int i = 0; i < 10; i++) { Console.WriteLine("test string".Surprise()); } Console.WriteLine(MathFunction(10, (i) => { return(i + 100); })); Console.WriteLine(MathFunction(10, (i) => { return(i - 100); })); AnotherAction(33, (i) => Console.WriteLine(i)); Console.WriteLine(AnotherFunc(22, (a, b) => a * b)); // samma som Console.WriteLine(AnotherFunc(22, (a,b) => { return a * b; } )); Med return måste man ha måsvingar. // Kolla hur det fungerar med index i lambda-exp. int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var firstSmallNumbers = numbers.TakeWhile((n, index) => n >= index); foreach (var item in firstSmallNumbers) { Console.WriteLine(item); } }
// This is just a helper method to allow us to enumerate all known types // and validate we can extract the element type private void ValidateElementType <T>() { T x = default(T); T[] xArray = new T[0]; IEnumerable <T> ie = new List <T>(); MyGenericClass <T> genericGeneric = new MyGenericClass <T>(); if ((object)x != null) // ref types would yield null ref on GetType { Assert.AreEqual(typeof(T), TypeUtility.GetElementType(x.GetType())); } Assert.AreEqual(typeof(T), TypeUtility.GetElementType(xArray.GetType())); Assert.AreEqual(typeof(T), TypeUtility.GetElementType(ie.GetType())); // Validate GetElementType does NOT go recursive Assert.AreEqual(typeof(MyGenericClass <T>), TypeUtility.GetElementType(genericGeneric.GetType())); }
static void Main(string[] args) { Subjects subjects = new Subjects(); try { Theory t1 = new Theory(); t1.ID = 1; t1.Name = "Theory subject1"; t1.Marks = 150; Lab l1 = new Lab(); Console.WriteLine("Enter subject id"); l1.ID = Convert.ToInt32(Console.ReadLine()); l1.Name = "Lab1"; l1.Internals = 30; subjects.Add(t1); subjects.Add(l1); foreach (Subject item in subjects.GetAllSubjets()) { Console.WriteLine(item.Name); } MyGenericClass <int, Subject> myGenericClass = new MyGenericClass <int, Subject>(); } catch (DuplicateKeyException ex) { Console.WriteLine(ex.Message); } catch (FormatException ex) { Console.WriteLine(ex.Message); } catch (Exception ex) { Console.WriteLine(ex.Message); }finally { Console.WriteLine("Always executed"); Console.ReadLine(); } }
public void GenericClass() { var ofString = new MyGenericClass <string>("xyz", int.MinValue); var ofString2 = ZeroFormatterSerializer.Convert(ofString); ofString2.x.Is("xyz"); ofString2.y.Is(int.MinValue); var ofMGS = new MyGenericClass <MyGenericStruct <double> >( new MyGenericStruct <double>(0, 2, 3), int.MinValue); var ofMGS2 = ZeroFormatterSerializer.Convert(ofMGS); ofMGS2.x.x.Is(0d); ofMGS2.x.y.Is(2); ofMGS2.x.z.Is(3d); ofMGS2.y.Is(int.MinValue); }
static void Main(string[] args) { //// Point using ints. //Point<int> p = new Point<int>(10, 10); //// Point using double. //Point<double> p2 = new Point<double>(5.4, 3.3); Console.WriteLine("***** Fun with Generic Structures *****\n"); // Point using ints. Point <int> p = new Point <int>(10, 10); Console.WriteLine("p.ToString()={0}", p.ToString()); p.ResetPoint(); Console.WriteLine("p.ToString()={0}", p.ToString()); Console.WriteLine(); // Point using double. Point <double> p2 = new Point <double>(5.4, 3.3); Console.WriteLine("p2.ToString()={0}", p2.ToString()); p2.ResetPoint(); Console.WriteLine("p2.ToString()={0}", p2.ToString()); #region Constraning Type Parameters //MyGenericClass<int> myGeneric = new MyGenericClass<int>(); //MyGenericClass<string> myGeneric2 = new MyGenericClass<string>(); //MyGenericClass<Person> myGeneric2 = new MyGenericClass<Person>(); //MyGenericClass<TestClass> myGeneric2 = new MyGenericClass<TestClass>(); MyGenericClass <TestClass> mc = new MyGenericClass <TestClass>(); #endregion Console.ReadLine(); }
private static void Main(string[] args) { Helper studentList = new Helper(); Console.WriteLine("****Query Syntax in Linq****"); Query.QuerySyntax(); Console.WriteLine("****Method Syntax in Linq****"); Method.MethodSyntax(); Console.WriteLine("****Lambda Expression Action Delegate****"); Lambda.ActionLinq(); Console.WriteLine("****Lambda Expression Func Delegate****"); Console.WriteLine(Lambda.FuncLinq()); Console.WriteLine("****Enum****"); Console.WriteLine("Day: {0} No: {1}", Week.Friday, (int)Week.Friday); Console.WriteLine("****Print out all week in enum****"); foreach (var name in System.Enum.GetNames(typeof(Week))) { Console.WriteLine(name); } Console.WriteLine("****Delegate****"); //Print delegates PrintNumber Delegates.Print printDel = Delegates.Printnumber; printDel(10000); printDel(200); //Print delegates Money printDel = Delegates.PrintMoney; printDel(10000); printDel(200); Console.WriteLine("****Delegates as parameters"); //delegate as parameter Delegates.PrintHelper(Delegates.Printnumber, 10000); Delegates.PrintHelper(Delegates.PrintMoney, 10000); Console.WriteLine("****Delegates multicast"); //multicast Delegates.Print printMulti = Delegates.Printnumber; printMulti += Delegates.PrintMoney; printMulti += Delegates.PrintHexadecimal; printMulti(10000); Console.WriteLine("****Generic****"); MyGenericClass <int> intGenericClass = new MyGenericClass <int>(10); int val = intGenericClass.GenericMethod(200); //string generic Console.WriteLine("***Generic String****"); var stringGenericClass = new MyGenericClass <string>("Hello generic world"); stringGenericClass.GenericProperty = "This is a generic property example"; string result = stringGenericClass.GenericMethod("Generic Parameter"); Console.WriteLine("****Generic Delegate"); GenericDelegates.Add <int> sum = GenericDelegates.Addnumber; Console.WriteLine(sum(10, 20)); GenericDelegates.Add <string> conct = GenericDelegates.Concate; Console.WriteLine(conct("Hello", "World")); Console.WriteLine("****Generic Collections****"); string[] strArray = { "Hello", "World" }; ILists.Print(strArray); List <string> strList = new List <string> { "Hello", "World" }; ILists.Print(strList); Console.WriteLine("****Filter Operators****"); FilteringOperators s = new FilteringOperators(); s.OfTypeClause(); Console.WriteLine("****Grouping Operators****"); GroupingOperators g = new GroupingOperators(); g.ToLookUpOperator(); Console.WriteLine("****Joining Operators****"); JoiningOperators j = new JoiningOperators(); j.InnerJoin(); Console.WriteLine("****Quantifier Operators****"); QuantifierOperators q = new QuantifierOperators(); Console.WriteLine(q.ContainsOperator(studentList.StudentData())); Console.WriteLine("****Intersect Operators****"); SetOperators p = new SetOperators(); p.IntersectOperator(); Console.WriteLine("****Union Operators****"); p.UnionOperator(); Console.ReadLine(); }
private static void Main(string[] args) { Helper studentList = new Helper(); Console.WriteLine("****Query Syntax in Linq****"); Query.QuerySyntax(); Console.WriteLine("****Method Syntax in Linq****"); Method.MethodSyntax(); Console.WriteLine("****Lambda Expression Action Delegate****"); Lambda.ActionLinq(); Console.WriteLine("****Lambda Expression Func Delegate****"); Console.WriteLine(Lambda.FuncLinq()); Console.WriteLine("****Enum****"); Console.WriteLine("Day: {0} No: {1}", Week.Friday, (int) Week.Friday); Console.WriteLine("****Print out all week in enum****"); foreach (var name in System.Enum.GetNames(typeof (Week))) { Console.WriteLine(name); } Console.WriteLine("****Delegate****"); //Print delegates PrintNumber Delegates.Print printDel = Delegates.Printnumber; printDel(10000); printDel(200); //Print delegates Money printDel = Delegates.PrintMoney; printDel(10000); printDel(200); Console.WriteLine("****Delegates as parameters"); //delegate as parameter Delegates.PrintHelper(Delegates.Printnumber, 10000); Delegates.PrintHelper(Delegates.PrintMoney, 10000); Console.WriteLine("****Delegates multicast"); //multicast Delegates.Print printMulti = Delegates.Printnumber; printMulti += Delegates.PrintMoney; printMulti += Delegates.PrintHexadecimal; printMulti(10000); Console.WriteLine("****Generic****"); MyGenericClass<int> intGenericClass = new MyGenericClass<int>(10); int val = intGenericClass.GenericMethod(200); //string generic Console.WriteLine("***Generic String****"); var stringGenericClass = new MyGenericClass<string>("Hello generic world"); stringGenericClass.GenericProperty = "This is a generic property example"; string result = stringGenericClass.GenericMethod("Generic Parameter"); Console.WriteLine("****Generic Delegate"); GenericDelegates.Add<int> sum = GenericDelegates.Addnumber; Console.WriteLine(sum(10, 20)); GenericDelegates.Add<string> conct = GenericDelegates.Concate; Console.WriteLine(conct("Hello", "World")); Console.WriteLine("****Generic Collections****"); string[] strArray = {"Hello", "World"}; ILists.Print(strArray); List<string> strList = new List<string> { "Hello", "World" }; ILists.Print(strList); Console.WriteLine("****Filter Operators****"); FilteringOperators s = new FilteringOperators(); s.OfTypeClause(); Console.WriteLine("****Grouping Operators****"); GroupingOperators g = new GroupingOperators(); g.ToLookUpOperator(); Console.WriteLine("****Joining Operators****"); JoiningOperators j = new JoiningOperators(); j.InnerJoin(); Console.WriteLine("****Quantifier Operators****"); QuantifierOperators q = new QuantifierOperators(); Console.WriteLine(q.ContainsOperator(studentList.StudentData())); Console.WriteLine("****Intersect Operators****"); SetOperators p = new SetOperators(); p.IntersectOperator(); Console.WriteLine("****Union Operators****"); p.UnionOperator(); Console.ReadLine(); }
public static void MyGenericMethod <TSomeClass, TSomeInterface> (MyGenericClass <TSomeClass> that) where TSomeClass : TSomeInterface { // use "that" instead of this }
static void Main(string[] args) { var myTuple = returnVals(); Console.WriteLine($"1 = { myTuple.Item1}"); //myTuple.Item2 = "new item 2";//this gives error read only Console.WriteLine($"2 = { myTuple.Item2}"); Console.WriteLine($"3 = { myTuple.Item3}"); Console.WriteLine($"4 = { myTuple.Item4.ToString("N0")}"); Console.WriteLine($"5 = { myTuple.Item5.ToString("N0")}"); Console.WriteLine($"6 = { myTuple.Item6.ToString("N2")}"); Console.WriteLine($"7 = { myTuple.Item7}"); Console.WriteLine($"8 = { myTuple.Rest.Item1}"); Console.WriteLine($"9 = { myTuple.Rest.Item2}"); Console.Clear(); csRefType ref1 = new csRefType(); csRefType ref2 = ref1; ref2.gg = "ref 2";//ref 2 and ref 1 points to the same value same variable ref1.gg = "ref 1"; Console.WriteLine($"ref 1.gg = {ref1.gg}"); Console.WriteLine($"re2 2.gg = {ref2.gg}"); valType val1; val1.wp = "g"; valType val2 = val1; val2.wp = "val 2";//ref 2 and ref 1 points to the same value same variable val1.wp = "val 1"; Console.WriteLine($"val 1.wp = {val1.wp}"); Console.WriteLine($"val 2.wp = {val2.wp}"); Console.Clear(); MyGenericClass <double> myDoubleClass = new MyGenericClass <double>(43); myDoubleClass.genericMethod(myDoubleClass.genericProperty); MyGenericClass <string> myStringClass = new MyGenericClass <string>("gg wp"); myStringClass.genericMethod(myStringClass.genericProperty); addTwoEach2(new int[] { 1, 2, 3, 4, 5 }); addTwoEach(1, 2, 3, 4, 5); string myVal = "toros university"; string myKey = "b14ca5898a4e4133bbce2ea2315a1916"; var vrEncyrpttedText = SymetricEncyrption.EncryptString(myKey, myVal); Console.WriteLine($"{vrEncyrpttedText}"); var vrDecFalse = SymetricEncyrption.DecryptString("b15ca5898a4e4133bbce2ea2315a1916", vrEncyrpttedText); Console.WriteLine($"{vrDecFalse}"); var vrTruedec = SymetricEncyrption.DecryptString(myKey, vrEncyrpttedText); Console.WriteLine($"{vrTruedec}"); Chaining(); Chaining(); Console.ReadLine(); }
public virtual void Foo <K>(MyGenericClass <int> x, int y) { }
public virtual void Foo(MyGenericClass <T> x, string y) { }
public static void MyGenericMethod <TSomeClass, TSomeInterface>(this MyGenericClass <TSomeClass> self) where TSomeClass : TSomeInterface { //... }
public static void TestFieldSetValueOnInstantiationsThatAlreadyExistButAreNotKnownToReflection() { #if UNIVERSAL_GENERICS // The int instantiation is visible to both nutc and analysis, MyGenericClass<int>.MyGenericField appears in RequiredGenericFields. // This works. MyGenericClass <int> .SetField(3); FieldInfo intField = typeof(MyGenericClass <int>).GetTypeInfo().GetDeclaredField("MyGenericField"); intField.SetValue(null, 4); // The object instantiation is visible to both nutc and analysis, MyGenericClass<object>.MyGenericField appears in RequiredGenericFields. // This works. MyOtherGenericClass <object> .SetField(3); FieldInfo objectField = typeof(MyGenericClass <object>).GetTypeInfo().GetDeclaredField("MyGenericField"); objectField.SetValue(null, 4); // The double instantiation isn't visible to either nutc or analysis. Confirmed that SetField uses USG code. // This works. Type obfuscatedDoubleType = TypeOf.Double; Type doubleInstantiation = typeof(MyGenericClass <>).MakeGenericType(obfuscatedDoubleType); MethodInfo doubleSetterMethod = doubleInstantiation.GetTypeInfo().GetDeclaredMethod("SetField"); doubleSetterMethod.Invoke(null, new object[] { 1.0 }); FieldInfo doubleField = doubleInstantiation.GetTypeInfo().GetDeclaredField("MyGenericField"); doubleField.SetValue(null, 2.0); // The string instantiation isn't visible to either nutc or analysis. Confirmed that SetField uses USG (__UniversalCanon, not __Canon). Type obfuscatedStringType = TypeOf.String; Type stringInstantiation = typeof(MyGenericClass <>).MakeGenericType(obfuscatedStringType); MethodInfo stringSetterMethod = stringInstantiation.GetTypeInfo().GetDeclaredMethod("SetField"); stringSetterMethod.Invoke(null, new object[] { "bar" }); FieldInfo stringField = stringInstantiation.GetTypeInfo().GetDeclaredField("MyGenericField"); stringField.SetValue(null, "foo"); // The stringbuilder instantiation is visible to nutc, but analysis doesn't know it needs reflection. Even though the type has compiled code (__Canon shared generic), // the reflection method invoke calls into __UniversalCanon USG. The field invoke throws. MyGenericClass <StringBuilder> .SetField(new StringBuilder("baz")); // Uses __Canon implementation string obfuscatedSbName = "System.Text.StringBuildery"; obfuscatedSbName = obfuscatedSbName.Remove(obfuscatedSbName.Length - 1); Type obfuscatedSbType = Type.GetType(obfuscatedSbName); Type sbInstantiation = typeof(MyGenericClass <>).MakeGenericType(obfuscatedSbType); MethodInfo sbSetterMethod = sbInstantiation.GetTypeInfo().GetDeclaredMethod("SetField"); sbSetterMethod.Invoke(null, new object[] { new StringBuilder("bar") }); // Uses __UniversalCanon implementation FieldInfo uriField = sbInstantiation.GetTypeInfo().GetDeclaredField("MyGenericField"); StringBuilder newStringBuilder = new StringBuilder("foo"); uriField.SetValue(null, newStringBuilder); // Throws a MissingRuntimeArtifactException Assert.AreEqual(newStringBuilder, MyGenericClass <StringBuilder> .MyGenericField); // The float instantiation is visible to nutc, but analysis doesn't know it needs reflection. Even though the type has compiled code (specialized to float), // the reflection method invoke calls into __UniversalCanon USG. The field invoke throws. MyGenericClass <float> .SetField(1.0f); // Uses float implementation (even uses vector registers!) string obfuscatedFloatName = "System.Singley"; obfuscatedFloatName = obfuscatedFloatName.Remove(obfuscatedFloatName.Length - 1); Type obfuscatedFloatType = Type.GetType(obfuscatedFloatName); Type floatInstantiation = typeof(MyGenericClass <>).MakeGenericType(obfuscatedFloatType); MethodInfo floatSetterMethod = floatInstantiation.GetTypeInfo().GetDeclaredMethod("SetField"); floatSetterMethod.Invoke(null, new object[] { 3.0f }); // Uses __UniversalCanon implementation FieldInfo floatField = floatInstantiation.GetTypeInfo().GetDeclaredField("MyGenericField"); floatField.SetValue(null, 2.0f); // Throws a MissingRuntimeArtifactException Assert.AreEqual(2.0f, MyGenericClass <float> .MyGenericField); FieldInfo threadStaticFloatField = floatInstantiation.GetTypeInfo().GetDeclaredField("MyThreadStaticField"); threadStaticFloatField.SetValue(null, 6.0f); // Throws a MissingRuntimeArtifactException Assert.AreEqual(6.0f, MyGenericClass <float> .MyThreadStaticField); // The stringbuilder instantiation is visible to nutc, but analysis doesn't know it needs reflection. MyOtherGenericClass <StringBuilder> .SetField(new StringBuilder("baz")); // Uses __Canon implementation Type sbInstantiationOther = typeof(MyOtherGenericClass <>).MakeGenericType(obfuscatedSbType); MethodInfo sbOtherSetterMethod = sbInstantiationOther.GetTypeInfo().GetDeclaredMethod("SetField"); sbOtherSetterMethod.Invoke(null, new object[] { new StringBuilder("bar") }); // Uses __Canon implementation FieldInfo otherField = sbInstantiationOther.GetTypeInfo().GetDeclaredField("MyGenericField"); otherField.SetValue(null, newStringBuilder); // Throws a MissingRuntimeArtifactException Assert.AreEqual(newStringBuilder, MyOtherGenericClass <StringBuilder> .MyGenericField); FieldInfo threadStaticSbOtherField = sbInstantiationOther.GetTypeInfo().GetDeclaredField("MyThreadStaticField"); threadStaticSbOtherField.SetValue(null, newStringBuilder); // Throws a MissingRuntimeArtifactException Assert.AreEqual(newStringBuilder, MyOtherGenericClass <StringBuilder> .MyThreadStaticField); #endif }
public void Run() { MyGenericClass <int> intGenericClass = new MyGenericClass <int>(10); intGenericClass.genericMethod(200); }
static void Main(string[] args) { List <Dog> dogs = new List <Dog> { new Dog("retriever", "Sarko", 7, "Brown"), new Dog("haskey", "Mailo", 2, "White"), new Dog("retriever", "Leo", 3, "Black") }; List <Cat> cats = new List <Cat> { new Cat(true, "Garfield", 3, "Brown"), new Cat(false, "Tom", 2, "Black"), new Cat(false, "Kitty", 3, "white") }; List <Bird> birds = new List <Bird> { new Bird(false, "Cavka", 1, "Black"), new Bird(false, "Kokoska", 1, "Brown"), new Bird(true, "Lastovica", 2, "Black") }; var retriever = dogs.Where(x => x.Race == "retriever"); foreach (Dog retrieve in retriever) { Console.WriteLine(retrieve.Name); } var lastLazyCat = cats.Last(x => x.isLazy == true); Console.WriteLine(lastLazyCat.Name); var wildBirdsYoungerThan3 = birds.Where(x => x.isWild == true && x.Age < 3).OrderBy(x => x.Name).ToList(); foreach (Bird bird in wildBirdsYoungerThan3) { Console.WriteLine($"Bird younger than 3 {bird.Name}"); } var name = "Goran"; Console.WriteLine(name.FirstLetter()); Console.WriteLine(name.LastLetter()); var c = dogs.FirstInt(9); foreach (var item in c) { Console.WriteLine(item.Name); } List <int> int322 = new List <int> { 3, 6, 2, 8, 2, 15, 16, 18 }; List <string> strings = new List <string> { "Krste", "Dragan", "Petko" }; MyGenericClass generici = new MyGenericClass(); generici.Print(int322); generici.Print(strings); generici.PrintAnimals(dogs); string str1 = "Gorana"; string str2 = "blabla"; StringMagic(str1, str2, (x, y) => { if (x.Length > y.Length) { return(true); } return(false); }); StringMagic(str1, str2, (x, y) => { if (x.ToCharArray().First() == y.ToCharArray().First()) { return(true); } return(false); }); StringMagic(str1, str2, (x, y) => { if (x.ToCharArray().Last() == y.ToCharArray().Last()) { return(true); } return(false); }); Publisher p = new Publisher(); Subscriber1 s1 = new Subscriber1(); Subscriber2 s2 = new Subscriber2(); Subscriber3 s3 = new Subscriber3(); p.EventHandler += s1.Subscribe1Process; p.EventHandler += s2.Subscribe2Process; p.EventHandler += s3.Subscribe3Process; p.ComposeMessage("Dragan", 1, "DECKI UCETE"); Console.ReadLine(); }
public void ReceivingMethod <T2>(Expression <Func <T, T2> > expression) { MyGenericClass <T, T2> genericImp = new MyGenericClass <T, T2>(expression); }
public static void Test() { MyGenericClass <object> genericObject = new MyGenericClass <object>(); genericObject.value = new object(); }
public void GetDependent() { var dependent1 = new MyGenericClass<Jafarullah>().GetDependentDetai<string>("Dubai", "India"); var dependent2 = new MyGenericClass<Yasila>().GetDependentDetai<string>("Singapore", "India"); var dependent3 = new MyGenericClass<Najima>().GetDependentDetai<string>("India", "India"); }
public static void Test2() { MyGenericClass <int> genericObject = new MyGenericClass <int>(); genericObject.value = 10; }
public override void Foo <K>(MyGenericClass <K> x, int y) { }
public static void Test3() { MyGenericClass <MyObject> genericObject = new MyGenericClass <MyObject>(); genericObject.value = new MyObject(1); }
public override void Foo(MyGenericClass <T> x, string y) { }
public static void Test4() { IMyInterface <int> genericInterface = new MyGenericClass <int>(); }
public static void Main() { MyGenericClass <int> intGenericClass = new MyGenericClass <int>(10); int val = intGenericClass.genericMethod(200); }
static void Main(string[] args) { var inst = new MyGenericClass <Class1>(); }