-
Collections in c#
Hello, I am student of BSC.I.T. and learning C# currently. I want details about the Collection classes in C#. If anyone is having knowledge about it then please provide me that. I have searched on internet But the language used is too much difficult. So, if you provide me some points about it then it can be helpful to me.
-
Re: Collections in c#
When .Net Framework is developed it is developed with the facility that will able to provide you specialized classes for storing your data and also retrieve your stored data. These classes can support for the stacks, queues, lists, and hash tables. Most of the time you can come to know that the most of the collection classes will implement the same interface and those all interfaces will be inherited to create new collection classes.
-
Re: Collections in c#
If you want to implement the custom collection class then you may need to use the coding below:
Code:
using System;
using System.Collections;
public class First: CollectionBase
{
public First this[int i]
{
get
{
return ((First)(List[i]));
}
set
{
List[i] = value;
}
}
public bool Contains(First first)
{
return List.Contains(first);
}
public int Add(First First)
{
return List.Add(First);
}
public void Insert(int i, First first)
{
List.Insert(i, first);
}
public void Remove(First first)
{
List.Remove(First);
}
}
-
Re: Collections in c#
If you consider the collections in C# then you come to know that the c# collections may contain mane different forms. The System.Collections namespace provides you different classes, methods and properties.
System.Collections namespace includes following interfaces:
- IEnumerable
- IEnumerator
- ICollection
- IList
- IDictionary
-
Re: Collections in c#
For getting more information about the C# collections you may need to use the different books provided by the different authors. You can also search for the different pdf files which are available free of cost on internet and get knowledge about the c# from that. So, just make use of all those sources and you will able to get the solution for it.
-
Re: Collections in c#
C# uses collection classes for different purposes. It is the set of classes which are developed for specially making group of objects and by the use of them you can able to perform specific task from them. There are many more collection classes available in C#, but mostly list and arraylist is used.
Syntax for creating a List<T> :
Code:
List<type> name = new List<type>();
Syntax for creating a ArrayList :
Code:
ArrayList name = new ArrayList();
Page generated in 1,713,865,824.01185 seconds with 11 queries