7
Reply

What is generic type ?

Sandeep Kumar

Sandeep Kumar

Dec 27, 2015
1.1k
0

    It reduce the code repetition ...............

    Bilal Ansari
    October 08, 2016
    1

    It reduce the code repetition ...............

    Bilal Ansari
    October 08, 2016
    0

    Generic mean generalization of code, Writing generic code to reduce repetition of code.

    Amit Kumawat
    September 21, 2016
    0

    To reduce the code repetition, generics is introduced where which has tendency to deal with any type of datatype which was defined during run-time.

    Generics were added to version 2.0 of the C# language and the common language runtime (CLR). Generics introduce to the .NET Framework the concept of type parameters, which make it possible to design classes and methods that defer the specification of one or more types until the class or method is declared and instantiated by client code. For example, by using a generic type parameter T you can write a single class that other client code can use without incurring the cost or risk of runtime casts or boxing operations public class GenericList { void Add(T input) { } } class TestGenericList { private class ExampleClass { } static void Main() { // Declare a list of type int. GenericList list1 = new GenericList(); // Declare a list of type string. GenericList list2 = new GenericList(); // Declare a list of type ExampleClass. GenericList list3 = new GenericList(); } }

    Kml Surani
    January 09, 2016
    0

    Generics were added to version 2.0 of the C# language and the common language runtime (CLR). Generics introduce to the .NET Framework the concept of type parameters, which make it possible to design classes and methods that defer the specification of one or more types until the class or method is declared and instantiated by client code. For example, by using a generic type parameter T you can write a single class that other client code can use without incurring the cost or risk of runtime casts or boxing operationspublic class GenericList {void Add(T input) { } } class TestGenericList {private class ExampleClass { }static void Main(){// Declare a list of type int.GenericList list1 = new GenericList();// Declare a list of type string.GenericList list2 = new GenericList();// Declare a list of type ExampleClass.GenericList list3 = new GenericList();} }

    Praveen Dhatrika
    December 30, 2015
    0

    Generic type use to seprate the data type or it use to make collection as strong type.

    Sandeep Kumar
    December 27, 2015
    0