GENERICS EXAMPLE 1 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication15 { class Program { public static void DisplayArray(T[] array) { foreach (T item in array) { Console.WriteLine("{0}",item); } } static void Main(string[] args) { string[] myFriends = { "vijay","raj","sunil"}; int[] mm = {1,2,3}; //Program p = new Program(); //invoke generic method and specify type parameter implicitily Program.DisplayArray(myFriends); Program.DisplayArray(mm); //invoke generic method and specify type parameter implicitily //p.DisplayArray (myFriends); //p.DisplayArray (mm); } } } GENERICS EXAMPLE 2 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication16 { class Program { public static void display (T s) { Console.WriteLine("value is:-"+s); } static void Main(string[] args) { display (12); display ("vijay"); display (19.6); } } }
Wednesday, 4 April 2012
GENERICS
Subscribe to:
Post Comments (Atom)
CRUD operations using AngularJS in Asp.Net MVC
In this article I will show you how to perform CRUD operations in Asp.Net MVC5 using AngularJS. Add AngularJS using the Manage Nuget Pack...
-
To implement the AutoComplete Textbox in Windows form C#.net you need to follow the below steps : Step1 : First you need to des...
-
To implement this concept you need to follow the below steps : Step1 : First you need to design a table in Sql Database to inser...
-
Here in this example i used the 3 Tier Architecture for Inserting and Retrieving Data from database and viewed in the Gridview. 3 tier a...
No comments:
Post a Comment