Click here to Skip to main content
15,906,333 members
Home / Discussions / C#
   

C#

 
AnswerRe: MyNamespace in C# Pin
Christian Graus19-Apr-07 22:59
protectorChristian Graus19-Apr-07 22:59 
GeneralRe: MyNamespace in C# Pin
Brady Kelly20-Apr-07 0:15
Brady Kelly20-Apr-07 0:15 
AnswerRe: MyNamespace in C# Pin
Guffa20-Apr-07 2:38
Guffa20-Apr-07 2:38 
GeneralRe: MyNamespace in C# Pin
Brady Kelly20-Apr-07 2:45
Brady Kelly20-Apr-07 2:45 
AnswerRe: MyNamespace in C# Pin
Dave Doknjas20-Apr-07 14:04
Dave Doknjas20-Apr-07 14:04 
Questionget data in datagridview Pin
Nekshan19-Apr-07 22:30
Nekshan19-Apr-07 22:30 
AnswerRe: get data in datagridview Pin
virendra patel19-Apr-07 22:44
virendra patel19-Apr-07 22:44 
GeneralRe: get data in datagridview Pin
virendra patel19-Apr-07 22:45
virendra patel19-Apr-07 22:45 
GeneralRe: get data in datagridview Pin
Nekshan19-Apr-07 22:51
Nekshan19-Apr-07 22:51 
GeneralRe: get data in datagridview Pin
Nekshan19-Apr-07 23:00
Nekshan19-Apr-07 23:00 
GeneralRe: get data in datagridview Pin
virendra patel19-Apr-07 23:03
virendra patel19-Apr-07 23:03 
AnswerRe: get data in datagridview Pin
virendra patel19-Apr-07 22:48
virendra patel19-Apr-07 22:48 
AnswerRe: get data in datagridview Pin
Keshav V. Kamat20-Apr-07 0:26
Keshav V. Kamat20-Apr-07 0:26 
AnswerRe: get data in datagridview Pin
Keshav V. Kamat22-Apr-07 23:25
Keshav V. Kamat22-Apr-07 23:25 
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 

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.