Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
GeneralRe: Flickering Pin
Luc Pattyn2-Dec-10 4:22
sitebuilderLuc Pattyn2-Dec-10 4:22 
QuestionBeginners help with classes Pin
kruegs352-Dec-10 2:43
kruegs352-Dec-10 2:43 
AnswerRe: Beginners help with classes Pin
Hiren solanki2-Dec-10 2:55
Hiren solanki2-Dec-10 2:55 
AnswerRe: Beginners help with classes Pin
Luc Pattyn2-Dec-10 2:59
sitebuilderLuc Pattyn2-Dec-10 2:59 
AnswerRe: Beginners help with classes Pin
musefan2-Dec-10 3:13
musefan2-Dec-10 3:13 
GeneralRe: Beginners help with classes Pin
kruegs352-Dec-10 3:28
kruegs352-Dec-10 3:28 
GeneralRe: Beginners help with classes Pin
musefan2-Dec-10 3:38
musefan2-Dec-10 3:38 
GeneralRe: Beginners help with classes Pin
PIEBALDconsult2-Dec-10 8:25
mvePIEBALDconsult2-Dec-10 8:25 
Yes, yes you can. But does it make sense to do so in your particular application?

In my opinion (and it may be rather unpopular with the Linq-fanboys), you should only do that if you have the data hanging around for a while and interacting with other classes. In most of the applications I write, that doesn't happen. Maybe I read a line from a CSV file, parse it directly into SqlParameters and do an Insert, or query some data via a DataReader and write it out (CSV, XML, etc.) -- there is absolutely no need to store the data in a class, it would just needlessly bog things down.

But, there are times where having data in classes is useful. For instance maybe your car has an owner -- you can have separate classes for the car and its owner, with a relationship between them*. Now, I don't think Linq can do that (I could very easily be wrong about that), at most it would have separate classes for car and owner, but no relationship. In a DataSet (which I also don't use) the DataTables might have a relationship, but as far as I know, Linq won't.

I would also use a class if I'm passing data across a Web Service -- and I don't know whether or not Linq can do that.

So, when I use classes to hold data, I don't use Linq or EF or any other ORM tool -- I craft them myself.

*
class Person { ... }
class Car { ... Person Owner ... }

Person me = new Person(...) ;
Car mycar = new Car(...) ;
mycar.Owner = me ;

AnswerRe: Beginners help with classes Pin
#realJSOP2-Dec-10 3:21
mve#realJSOP2-Dec-10 3:21 
GeneralRe: Beginners help with classes Pin
kruegs352-Dec-10 3:45
kruegs352-Dec-10 3:45 
GeneralRe: Beginners help with classes Pin
Jeff Connelly2-Dec-10 4:53
Jeff Connelly2-Dec-10 4:53 
GeneralRe: Beginners help with classes Pin
DaveyM692-Dec-10 9:30
professionalDaveyM692-Dec-10 9:30 
AnswerRe: Beginners help with classes Pin
V.2-Dec-10 23:31
professionalV.2-Dec-10 23:31 
QuestionExecuteNonQuery Problem Pin
Erdinc272-Dec-10 1:40
Erdinc272-Dec-10 1:40 
AnswerRe: ExecuteNonQuery Problem PinPopular
Hiren solanki2-Dec-10 1:46
Hiren solanki2-Dec-10 1:46 
GeneralRe: ExecuteNonQuery Problem Pin
Eddy Vluggen2-Dec-10 1:53
professionalEddy Vluggen2-Dec-10 1:53 
GeneralRe: ExecuteNonQuery Problem Pin
Erdinc272-Dec-10 2:05
Erdinc272-Dec-10 2:05 
AnswerRe: ExecuteNonQuery Problem Pin
musefan2-Dec-10 1:47
musefan2-Dec-10 1:47 
GeneralRe: ExecuteNonQuery Problem Pin
musefan2-Dec-10 6:25
musefan2-Dec-10 6:25 
QuestionError regarding crystal report? Pin
Tridip Bhattacharjee2-Dec-10 1:31
professionalTridip Bhattacharjee2-Dec-10 1:31 
AnswerRe: Error regarding crystal report? Pin
Hiren solanki2-Dec-10 1:50
Hiren solanki2-Dec-10 1:50 
QuestionWinForms VS. WebForms Pin
treuveni2-Dec-10 1:24
treuveni2-Dec-10 1:24 
AnswerRe: WinForms VS. WebForms Pin
Hiren solanki2-Dec-10 1:32
Hiren solanki2-Dec-10 1:32 
AnswerRe: WinForms VS. WebForms Pin
Sathesh Sakthivel2-Dec-10 1:50
Sathesh Sakthivel2-Dec-10 1:50 
GeneralRe: WinForms VS. WebForms Pin
Hiren solanki2-Dec-10 1:57
Hiren solanki2-Dec-10 1:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.