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

C#

 
GeneralRe: Is it possible to battery status of Digital camera using c# and WIA? Pin
Dave Kreskowiak1-Mar-12 12:59
mveDave Kreskowiak1-Mar-12 12:59 
GeneralRe: Is it possible to battery status of Digital camera using c# and WIA? Pin
Icarii1-Mar-12 16:50
Icarii1-Mar-12 16:50 
QuestionExchange Server 2007 - Commands Pin
Sebastian T Xavier29-Feb-12 22:53
Sebastian T Xavier29-Feb-12 22:53 
AnswerRe: Exchange Server 2007 - Commands Pin
Dave Kreskowiak1-Mar-12 3:37
mveDave Kreskowiak1-Mar-12 3:37 
QuestionQuick Constructor Question Pin
Kevin Marois29-Feb-12 12:01
professionalKevin Marois29-Feb-12 12:01 
AnswerRe: Quick Constructor Question Pin
RobCroll29-Feb-12 13:36
RobCroll29-Feb-12 13:36 
GeneralRe: Quick Constructor Question Pin
J4amieC1-Mar-12 5:22
J4amieC1-Mar-12 5:22 
AnswerRe: Quick Constructor Question Pin
GParkings29-Feb-12 22:47
GParkings29-Feb-12 22:47 
Personally, i would be asking why I wanted to do this.

I assume that the SetupViewModel method requires the DataEntity property to be set.

What, immediately becomes apparent is that you have a method, whose body is declared in the subclass, acting on data, declared in the subclass after all logic in the base class constructor has been performed .. Is it really necessary to have SetupViewModel as an abstract in the base as it is entirely specific to the subclass?

If you need to ensure setup functionality has occurred before other logic in the base class is run you could consider a protected _isInitialized boolean field alongside the abstract SetupViewModel method. Then check _isInitialized before performing logic and if it is false, call SetupViewModel (which, since the subclass constructor will have run by this point, will be able to access DataEntity )

An alternative is to consider whether all subclasses would ahve a common base for their data entity, in which case the base class could have a field of this type (or a collection of this type) and the field could be passed into the base constructor.

A further alternative is to make _ViewModelBase generic (_ViewModelBase<t> ) with a DataEntity of type T and, again, pass this to the base class
Pedis ex oris
Quidquid latine dictum sit, altum sonatur

AnswerRe: Quick Constructor Question Pin
BobJanova1-Mar-12 5:27
BobJanova1-Mar-12 5:27 
QuestionPassing values between classes Pin
CCodeNewbie29-Feb-12 10:33
CCodeNewbie29-Feb-12 10:33 
AnswerRe: Passing values between classes Pin
Wes Aday29-Feb-12 10:54
professionalWes Aday29-Feb-12 10:54 
GeneralRe: Passing values between classes Pin
CCodeNewbie29-Feb-12 11:11
CCodeNewbie29-Feb-12 11:11 
GeneralRe: Passing values between classes Pin
Wes Aday29-Feb-12 11:24
professionalWes Aday29-Feb-12 11:24 
GeneralRe: Passing values between classes Pin
CCodeNewbie29-Feb-12 11:37
CCodeNewbie29-Feb-12 11:37 
GeneralRe: Passing values between classes Pin
Pete O'Hanlon29-Feb-12 11:45
mvePete O'Hanlon29-Feb-12 11:45 
GeneralRe: Passing values between classes Pin
CCodeNewbie29-Feb-12 11:56
CCodeNewbie29-Feb-12 11:56 
GeneralRe: Passing values between classes Pin
Wes Aday29-Feb-12 12:44
professionalWes Aday29-Feb-12 12:44 
GeneralRe: Passing values between classes Pin
Pete O'Hanlon29-Feb-12 22:14
mvePete O'Hanlon29-Feb-12 22:14 
GeneralRe: Passing values between classes Pin
CCodeNewbie5-Mar-12 6:07
CCodeNewbie5-Mar-12 6:07 
SuggestionRe: Passing values between classes Pin
Pete O'Hanlon29-Feb-12 11:28
mvePete O'Hanlon29-Feb-12 11:28 
GeneralRe: Passing values between classes Pin
CCodeNewbie29-Feb-12 11:53
CCodeNewbie29-Feb-12 11:53 
AnswerRe: Passing values between classes Pin
CCodeNewbie29-Feb-12 12:11
CCodeNewbie29-Feb-12 12:11 
AnswerRe: Passing values between classes Pin
BobJanova1-Mar-12 5:23
BobJanova1-Mar-12 5:23 
GeneralRe: Passing values between classes Pin
DaveyM691-Mar-12 9:47
professionalDaveyM691-Mar-12 9:47 
GeneralRe: Passing values between classes Pin
Pete O'Hanlon1-Mar-12 11:29
mvePete O'Hanlon1-Mar-12 11: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.