Beispiel #1
0
 internal static void type_parameter_constraints(this TextWriter trapFile, TypeParameterConstraints constraints, TypeParameter typeParam)
 {
     trapFile.WriteTuple("type_parameter_constraints", constraints, typeParam);
 }
Beispiel #2
0
 internal static void specific_type_parameter_constraints(this TextWriter trapFile, TypeParameterConstraints constraints, Type baseType)
 {
     trapFile.WriteTuple("specific_type_parameter_constraints", constraints, baseType);
 }
Beispiel #3
0
 internal static void specific_type_parameter_nullability(this TextWriter trapFile, TypeParameterConstraints constraints, Type baseType, NullabilityEntity nullability)
 {
     trapFile.WriteTuple("specific_type_parameter_nullability", constraints, baseType, nullability);
 }
Beispiel #4
0
 internal static Tuple type_parameter_constraints(TypeParameterConstraints constraints, TypeParameter typeParam) => new Tuple("type_parameter_constraints", constraints, typeParam);
Beispiel #5
0
 internal static void general_type_parameter_constraints(this TextWriter trapFile, TypeParameterConstraints constraints, int hasKind)
 {
     trapFile.WriteTuple("general_type_parameter_constraints", constraints, hasKind);
 }
Beispiel #6
0
 internal static Tuple specific_type_parameter_constraints(TypeParameterConstraints constraints, Type baseType) => new Tuple("specific_type_parameter_constraints", constraints, baseType);
Beispiel #7
0
 internal static Tuple general_type_parameter_constraints(TypeParameterConstraints constraints, int hasKind) => new Tuple("general_type_parameter_constraints", constraints, hasKind);
Beispiel #8
0
 internal static void specific_type_parameter_annotation(this TextWriter trapFile, TypeParameterConstraints constraints, Type baseType, TypeAnnotation annotation)
 {
     trapFile.WriteTuple("specific_type_parameter_annotation", constraints, baseType, (int)annotation);
 }
Beispiel #9
0
 internal static Tuple specific_type_parameter_annotation(TypeParameterConstraints constraints, Type baseType, TypeAnnotation annotation) => new Tuple("specific_type_parameter_annotation", constraints, baseType, (int)annotation);
Beispiel #10
0
        static void Main(string[] args)
        {
            Program p1 = new Program();
            Int32 intBoxed = 10, unboxed;
            //boxing
            Object obj = (Object)intBoxed;
            //unboxing
            try
            {
                Int16 newint = (Int16)obj;
            }
            catch (InvalidCastException ice)
            {
                Console.WriteLine(ice.Message);
            }
            finally
            {
                Int32 newint = (Int32)obj;
                unboxed = newint;
            }
            //Int32 newint = (Int32)obj;
            Console.WriteLine(unboxed);
            p1.WorkingWithArrayList();
            p1.WorkingWithQueue();
            p1.WorkingWithSortedList();
            p1.WorkingWithStack();
            p1.WorkingWithGenerics();
            p1.GenericListDemo();
            p1.GenericStack();
            Demo d1 = new Demo();
            int x = 10, y = 20;
            d1.Swap<Int32>(ref x, ref y);
            Product product1 = new Product(0001, "book", 3.45);
            Product product2 = new Product(0002, "file", 2.13);
            d1.Swap<Product>(ref product1, ref product2);
            //d1.Swap(ref product1, ref product2); //not a standard approach, always specify Type Parameters

            GenericStructure<Int32> myStruct = new GenericStructure<int>(10, 25);
            //myStruct.Reset();
            Console.WriteLine(myStruct);

            TypeParameterConstraints<SatisfyingConstraints> scObj = new TypeParameterConstraints<SatisfyingConstraints>();
            scObj.Show(new SatisfyingConstraints(34.678));

            FinalGenericDerivedClass<Product, Employee> objFGDC = new FinalGenericDerivedClass<Product, Employee>();
            objFGDC.Show();
            Console.WriteLine(objFGDC);
            Console.ReadLine();
        }