Results 1 to 5 of 5

Thread: How are Collection object in C# categorized?

  1. #1
    Join Date
    Dec 2010
    Posts
    49

    How are Collection object in C# categorized?

    Hello my friends , I am a student of IT , I am being practicing various program in the C# language and Java, after following your forum in the Microsoft's Visual Studio, but I was learning collection object and got stuck there , so I would like any one of you can elaborate what exactly it means and how are these collection object categorized, I am waiting for your response , would appreciate your reply.

  2. #2
    Join Date
    May 2009
    Posts
    637

    Re: How are Collection object in C# categorized?

    We can have a method to collect up objects as they are produced so that we can handle them as a collection and work on them together, along with referring to them independently when needed. You can use this Collection to hold up a group of objects together and then make use of it in your program the best example of the Collection object is creating an Array list that holds an array of object . I think this much is enough if you are a beginner.

  3. #3
    Join Date
    May 2009
    Posts
    527

    Re: How are Collection object in C# categorized?

    There is a best example that can distinguish among the Collection objet and its properties . For example:
    • A Professor object may require to step throughout all Student objects register for a specific Course that the teacher is teaching in order to calculate their grades.
    • The Student Registration System (SRS) application as a in one piece might require to step throughout all of the Course objects in the present schedule of classes to conclude which of them do not yet have any students enrolled for them ,perhaps to call off these courses.

  4. #4
    Join Date
    Apr 2009
    Posts
    569

    Re: How are Collection object in C# categorized?

    We make use of a particular type of object known as a collection to cluster other objects. A collection object can have/enclose several references to some other kind of object. Imagine of a collection like an fruitcarton, and the objects it holds like the fruits ! Both are objects, but with apparently dissimilar properties. Since collections are being used as as objects, this implies that.
    • An object of the Collections should be created before they can be used . instantiated before they can first be used.
    • Classes define collection that in turn describe functions for "getting" and "setting"their elements .
    • The Object oriented collections are wrapped together and hence ensure data hiding.

  5. #5
    Join Date
    May 2009
    Posts
    543

    Re: How are Collection object in C# categorized?

    I think I can explain you this with an example

    Code:
    namespace ConsoleApplication1
    {
       class Program
       {
           static void Main(string[] args)
           {
    
               ArrayList pm = new ArrayList();
               pm.Add(5);
               pm.Add(3);
               pm.Add(7);
               pm.Add(11);
               pm.Add(13);
               pm.Add(17);
               Console.WriteLine("The Count of the Array list = " + pm.Count);
               for (int i=0; i<pm.Count; i++)
               {
                   Console.WriteLine(pm[i]);
               }
               pm.RemoveAt(3);
               Console.WriteLine("The Count of the Array list = " + pm.Count);
               for (int i = 0; i < pm.Count; i++)
               {
                   Console.WriteLine(pm[i]);
               }
    
    
               Console.ReadLine();
           }
    
    
           }
    }
    The ‘Add’ method will add a new object in the collection Array list , RemoveAt method removes the particular object at the specified index. And the count method will count the total number of objets in the array list.

Similar Threads

  1. Replies: 6
    Last Post: 06-06-2011, 01:34 AM
  2. Replies: 3
    Last Post: 08-01-2011, 06:20 AM
  3. Differents between object and static object
    By Sarfaraj Khan in forum Software Development
    Replies: 5
    Last Post: 29-01-2010, 01:11 PM
  4. How to set the defaultipgateway object which is not a collection
    By Pratyush in forum Software Development
    Replies: 3
    Last Post: 19-08-2009, 01:25 PM
  5. Object test = new Object() <-- Java, best way in C++
    By ADISH in forum Software Development
    Replies: 3
    Last Post: 25-10-2008, 02:32 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,306,584.01906 seconds with 17 queries