Click here to Skip to main content
15,923,374 members
Home / Discussions / C#
   

C#

 
GeneralRe: Calling MethodBase's Invoke on a constructor (reflection) Pin
blackblizzard30-Mar-10 5:14
blackblizzard30-Mar-10 5:14 
GeneralRe: Calling MethodBase's Invoke on a constructor (reflection) Pin
PIEBALDconsult30-Mar-10 7:35
mvePIEBALDconsult30-Mar-10 7:35 
GeneralRe: Calling MethodBase's Invoke on a constructor (reflection) Pin
blackblizzard30-Mar-10 8:00
blackblizzard30-Mar-10 8:00 
GeneralRe: Calling MethodBase's Invoke on a constructor (reflection) Pin
PIEBALDconsult30-Mar-10 8:42
mvePIEBALDconsult30-Mar-10 8:42 
GeneralRe: Calling MethodBase's Invoke on a constructor (reflection) Pin
blackblizzard30-Mar-10 8:48
blackblizzard30-Mar-10 8:48 
GeneralRe: Calling MethodBase's Invoke on a constructor (reflection) Pin
PIEBALDconsult30-Mar-10 9:49
mvePIEBALDconsult30-Mar-10 9:49 
AnswerRe: Calling MethodBase's Invoke on a constructor (reflection) Pin
PIEBALDconsult30-Mar-10 10:24
mvePIEBALDconsult30-Mar-10 10:24 
GeneralRe: Calling MethodBase's Invoke on a constructor (reflection) Pin
blackblizzard30-Mar-10 22:07
blackblizzard30-Mar-10 22:07 
PIEBALDconsult wrote:
An object containing the return value of the invoked method, or nullNothingnullptra null reference (Nothing in Visual Basic) in the case of a constructor."

So I think you have to cast.

Ah, I see. That's a bit weird, IMHO, but there you go Smile | :) . Good to get that out of the way, thanks for the info Smile | :)

As for your code, yep, that's pretty much what I was doing except for the generics. However the caller doesn't know the type of the object it's going to clone, so I'll keep it non-generic. But thanks for the alternative Smile | :)

Finally, they gave me a very good answer at Stack Overflow[^] using Func<,> instead of MethodBase. It's way more elegant (and very probably more efficient) so I'm adopting that solution.

Thanks for your input Smile | :)
(so many smiley faces! but there you go)
QuestionTotally custom windows forms Pin
r0seBa29-Mar-10 19:59
r0seBa29-Mar-10 19:59 
QuestionMail [modified] Pin
ravanth29-Mar-10 18:25
ravanth29-Mar-10 18:25 
AnswerRe: Mail Pin
PSK_29-Mar-10 18:37
PSK_29-Mar-10 18:37 
AnswerRe: Mail Pin
Abhinav S29-Mar-10 19:53
Abhinav S29-Mar-10 19:53 
Question32 bit dll on 64 bit Windows --- Windows Service? Pin
devvvy29-Mar-10 17:01
devvvy29-Mar-10 17:01 
AnswerRe: 32 bit dll on 64 bit Windows --- Windows Service? Pin
PSK_29-Mar-10 17:21
PSK_29-Mar-10 17:21 
AnswerRe: 32 bit dll on 64 bit Windows --- Windows Service? Pin
Bernhard Hiller30-Mar-10 3:17
Bernhard Hiller30-Mar-10 3:17 
Questioncheck for .doc application Pin
Jassim Rahma29-Mar-10 12:23
Jassim Rahma29-Mar-10 12:23 
AnswerRe: check for .doc application Pin
PSK_29-Mar-10 17:13
PSK_29-Mar-10 17:13 
QuestionStart adobe reader maximized Pin
Jassim Rahma29-Mar-10 12:21
Jassim Rahma29-Mar-10 12:21 
AnswerRe: Start adobe reader maximized Pin
Andrew Rissing29-Mar-10 15:20
Andrew Rissing29-Mar-10 15:20 
AnswerRe: Start adobe reader maximized Pin
Som Shekhar29-Mar-10 17:02
Som Shekhar29-Mar-10 17:02 
Questionbind textbox to XML node Pin
Jassim Rahma29-Mar-10 12:00
Jassim Rahma29-Mar-10 12:00 
QuestionReusable TableAdapters and such for Lookup Tables? Pin
Bert Edens29-Mar-10 11:40
Bert Edens29-Mar-10 11:40 
QuestionReading message Id's from a file?!? Pin
MWRivera29-Mar-10 11:13
MWRivera29-Mar-10 11:13 
AnswerRe: Reading message Id's from a file?!? Pin
Not Active29-Mar-10 12:12
mentorNot Active29-Mar-10 12:12 
GeneralRe: Reading message Id's from a file?!? Pin
MWRivera30-Mar-10 6:42
MWRivera30-Mar-10 6:42 

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.