Download presentation
Presentation is loading. Please wait.
Published bymuthana albabli Modified over 5 years ago
2
Introduction What the generic. What are the Generic types : - Class - Methods Type of coding the generic method. - Using the generic method within non-generic class - Using the generic method within generic class Features of Generics - Example for Generic What is the main different between the generic and non-generic class. What is the main different between the generic and non-generic methods. outline
3
Generics are the most powerful feature of C#. Generics allow you to define type-safe data structures, without committing to actual data types. This results in a significant performance boost and higher quality code, because you get to reuse data processing algorithms without duplicating type-specific code. Introduction
4
What the generic? allow you to delay the specification of the data type of programming elements in a class or a method, until it is actually used in the program. In other words, generic allow you to write a class or method that can work with any data type. You write the specifications for the class or the method, with substitute parameters for data types. When the compiler encounters a constructor for the class or a function call for the method, it generates code to handle the specific data type. What the generic
5
What are the Generic types : Class Methods Generic types
6
Generics types
7
- The easy way to write the generic class is :- class nameclass { } - We can use the variable with type of public T students; Generics types
8
9
Type of coding the generic method
10
11
Features of Generics
12
1- code the class EXAMPLE
13
2- code the button1((int)) 3- code the button2 ((char)) EXAMPLE
14
What is the main different between the generic and non-generic class? Generic class:- 1- This class can operate on any kind of object. 2- These objects each can operate on different type of data. Different between the generic and non-generic class.
15
16
Different between the generic and non-generic methods
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.