Re: Pass type to method to allow create and method invocation?
- From: UL-Tomten <tomten@xxxxxxxxx>
- Date: Fri, 17 Aug 2007 20:18:05 -0000
On Aug 17, 9:06 pm, "Grant Schenck" <schen...@xxxxxxxxxxxxx> wrote:
Instead of passing a Type to DoExecute() and creating an instance
inside the method, wouldn't it make more sense to create an instance
outside the method and pass that?
No because the class needs to be able to create instances of the specified
type in response to external events (in this case, phone calls.)
It still sounds like you could use type safe instance creation, like:
DoExecute<TScriptCall>() where TScriptCall : ScriptCallBase {
TScriptCall scriptCall = new TScriptCall();
scriptCall.OverriddenMethod();
}
....and invoke it thusly:
DoExecute<ScriptCallInbound>();
My point is that compile-time type safety in my experience usually
saves nine.
.
- References:
- Re: Pass type to method to allow create and method invocation?
- From: DeveloperX
- Re: Pass type to method to allow create and method invocation?
- From: UL-Tomten
- Re: Pass type to method to allow create and method invocation?
- From: Grant Schenck
- Re: Pass type to method to allow create and method invocation?
- Prev by Date: Re: Simple Report (Not a Crystal Report)
- Next by Date: Re: storing data not in xml nor database
- Previous by thread: Re: Pass type to method to allow create and method invocation?
- Next by thread: Re: Pass type to method to allow create and method invocation?
- Index(es):