Collection and Generics-Part 2(List and Dictionaries)
One can manage a group of items/objects using arrays or collections, we have already talked about arrays in the previous lecture, today we will talk about collections Collections provide a more flexible way to work with a group of objects. Yes flexible, collections can grow and shrink dynamically . One of the greatest advantage over Arrays. There are many collections provided by .Net framework, we will look at the most used collection classes Generic List Strongly typed list of elements that can be accessed by using positional index number. Declaration List < string > EmpNameList ; Declared EmpNameList which will hold elements of type string Initialization EmpNameList = new List < string >(); Operations //Add Element EmpNameList . Add ( "Employee1" ); //Re...
Comments
Post a Comment