Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is the use of a class with just properties and constructors and NO METHODS ?
Please explain in detail or refer...
Actually, I have been assigned a project for maintainence. and i see a lot of such classes in that project.


Regards.
Posted
Comments
Reiss 30-Sep-11 3:44am    
Are they abstract classes?

No wonder, I've seen such classes being used to simply store information about various entities (like structs in C++ - C# structs are quite rare) or to pass arguments many times. These classes could later be serialized, written to/read from database etc (the latter more often, it some people just love to map database structure to class structure :) ).
 
Share this answer
 
Comments
shikhar gilhotra 30-Sep-11 3:57am    
super !!! thanks Timber Bird..
shikhar gilhotra 3-Oct-11 3:47am    
Hi TimberBird, can you please pass some references....
Timberbird 3-Oct-11 4:57am    
These classes I'm talking were part of the project I've been working on, and I don't have access to them any more :). Which references would you like to see? There are really tons of examples, both for mapping class structure to database structure (like this link) and for serialization (eg this one)
Generally, they are to either just store relevant information and keep it together, or to derive from an existing class - adding functionality without adding functions. For example a class could derive from List and add no methods:
C#
public class Students : List<student>
   {
   public string ClassName { get; set; }
   }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900