Click here to Skip to main content
15,896,730 members
Home / Discussions / C#
   

C#

 
GeneralRe: get data in datagridview Pin
Nekshan23-Apr-07 21:12
Nekshan23-Apr-07 21:12 
QuestionCreate a component for C#? Pin
linhuu19-Apr-07 22:27
linhuu19-Apr-07 22:27 
Questioncopy dataset into other datase Pin
cocoonwls19-Apr-07 22:21
cocoonwls19-Apr-07 22:21 
QuestionPerformance: Partial Classes vs Inheritence? Pin
matsnas19-Apr-07 22:11
matsnas19-Apr-07 22:11 
AnswerRe: Performance: Partial Classes vs Inheritence? Pin
Colin Angus Mackay19-Apr-07 22:27
Colin Angus Mackay19-Apr-07 22:27 
GeneralRe: Performance: Partial Classes vs Inheritence? Pin
matsnas19-Apr-07 22:58
matsnas19-Apr-07 22:58 
GeneralRe: Performance: Partial Classes vs Inheritence? Pin
Colin Angus Mackay20-Apr-07 0:10
Colin Angus Mackay20-Apr-07 0:10 
GeneralRe: Performance: Partial Classes vs Inheritence? Pin
matsnas20-Apr-07 0:40
matsnas20-Apr-07 0:40 
Maby I'm still unclear in what I'm trying to do or I'm totally missunderstaning you.

Example: I have a product class that i subclsss in BookProdukt and FilmProduct. They both have Title and Genre as attributes but the book has ISBN number and author while the film has IMDB id and director. Both film and book should have a summary attribute that gives the Title and ISBN or IMDB number.

I would make a general product class that implements the title and genre attributes and two inhereting classes that implements the other respective attributes.

Thus:

Product<br />
- Title<br />
- Genre<br />
- Overrideble summary<br />
<br />
BookProduct<br />
- ISBN<br />
- Author<br />
- Overrides summary (returns ISBN + " " + Title)<br />
<br />
FilmProduct<br />
- IMDB<br />
- Director<br />
- Overrides summary (returns IMDB + " " + Title)<br />


As these objects are populated from a database I have a code generator that can create a file with the propertes for these attributes. As the generator cannot determine how the logic for the summary should be put together I need a way to seperate the logic (summary) from the data (Title, ISBN, etc) in case I need to regenerate the classes and don't want to loose the logic I've coded.

This can be done in (at least) two ways:

Alt1:

partial class FilmProduct<br />
- IMDB<br />
- Director<br />
<br />
partial class FilmProduct<br />
- Summary


Alt:

class BaseFilmProduct<br />
- IMDB<br />
- Director<br />
<br />
class FilmProduct : BaseFilmProduct<br />
- Summary


Now to the original question: Is there any performace gain in using either of the two alternatives?
GeneralRe: Performance: Partial Classes vs Inheritence? Pin
Luc Pattyn20-Apr-07 3:31
sitebuilderLuc Pattyn20-Apr-07 3:31 
GeneralRe: Performance: Partial Classes vs Inheritence? Pin
Colin Angus Mackay20-Apr-07 3:45
Colin Angus Mackay20-Apr-07 3:45 
AnswerRe: Performance: Partial Classes vs Inheritence? Pin
Scott Dorman20-Apr-07 3:25
professionalScott Dorman20-Apr-07 3:25 
QuestionConversion of LastModified method Pin
Amatista19-Apr-07 22:05
Amatista19-Apr-07 22:05 
AnswerRe: Conversion of LastModified method Pin
Jupiter920-Apr-07 7:32
Jupiter920-Apr-07 7:32 
GeneralRe: Conversion of LastModified method Pin
Amatista22-Apr-07 22:41
Amatista22-Apr-07 22:41 
QuestionControl.Visible Property Problem Pin
alashara19-Apr-07 21:43
alashara19-Apr-07 21:43 
AnswerRe: Control.Visible Property Problem Pin
Guffa19-Apr-07 23:05
Guffa19-Apr-07 23:05 
GeneralRe: Control.Visible Property Problem Pin
alashara20-Apr-07 2:44
alashara20-Apr-07 2:44 
QuestionSending more then 28 file names to string array in app creates error Pin
Yoav Ben Zvi19-Apr-07 21:34
Yoav Ben Zvi19-Apr-07 21:34 
AnswerRe: Sending more then 28 file names to string array in app creates error Pin
Yoav Ben Zvi20-Apr-07 0:29
Yoav Ben Zvi20-Apr-07 0:29 
AnswerRe: Sending more then 28 file names to string array in app creates error Pin
Luc Pattyn20-Apr-07 3:34
sitebuilderLuc Pattyn20-Apr-07 3:34 
QuestionCombobox in my DataGridView? Pin
akkram19-Apr-07 21:31
akkram19-Apr-07 21:31 
QuestionTreeView Pin
mihksoft19-Apr-07 21:27
mihksoft19-Apr-07 21:27 
AnswerRe: TreeView Pin
Yoav Ben Zvi19-Apr-07 21:38
Yoav Ben Zvi19-Apr-07 21:38 
QuestionXML Help Pin
umashankergr819-Apr-07 21:25
umashankergr819-Apr-07 21:25 
AnswerRe: XML Help Pin
Stefan Troschuetz19-Apr-07 21:29
Stefan Troschuetz19-Apr-07 21:29 

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.