Bikesh SrivastavaRank #108 · 20.3K reputationPosted Jan 10, 2017, 11:19 PM EST
0
Collection: Collection classes serve various purposes, such as allocating memory dynamically to elements and accessing a list of items on the basis of an index etc. These classes create collections of objects of the Object class, which is the base class for all data types in C#.
generic: Generics is a technique that enriches your programs in the following ways: It helps you to maximize code reuse, type safety, and performance. You can create genericcollection classes. The .NET Framework class library contains several new genericcollection classes in the System.Collections.Generic namespace.
0
Gnanavel SekarRank #333 · 7.5K reputationPosted Jan 11, 2017, 10:18 PM EST
0
Both to handle the bulk of data at runtime for certain time. it's like database but it's not hold the data permanently.
Collection : You may use while knew the type of data-it's under using system.collections
Generic : It's represent delay the specification of type of data- it's under using system.collections.generic
When you want to handle repetative process within single function/class the best choice is generic..
We may tell as Collection is to Static and Generic is to Dynamic.
Generic-public class TestClass (here we can pass any types, only type enough while passing data/ creating object)
Collection-public class TestClass(here we pass only int, if we want to change datatype means we have to overwrite our code in all inner blocks of code)
Vishal PrajapatiRank #836 · 2.7K reputationPosted Jan 10, 2017, 7:51 PM EST
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Jan 10, 2017, 11:19 PM EST
Gnanavel SekarRank #333 · 7.5K reputationPosted Jan 11, 2017, 10:18 PM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts