Click here to Skip to main content
15,893,668 members
Home / Discussions / C#
   

C#

 
GeneralRe: Need project suggestion Pin
Richard MacCutchan8-Nov-12 23:33
mveRichard MacCutchan8-Nov-12 23:33 
GeneralRe: Need project suggestion Pin
gopal pradhan8-Nov-12 23:36
gopal pradhan8-Nov-12 23:36 
GeneralRe: Need project suggestion Pin
Richard MacCutchan9-Nov-12 0:52
mveRichard MacCutchan9-Nov-12 0:52 
AnswerRe: Need project suggestion Pin
Rahul Rajat Singh9-Nov-12 0:54
professionalRahul Rajat Singh9-Nov-12 0:54 
QuestionRemote desktop in web application Pin
Chethan T R8-Nov-12 18:49
Chethan T R8-Nov-12 18:49 
AnswerRe: Remote desktop in web application Pin
Sivaraman Dhamodharan8-Nov-12 19:00
Sivaraman Dhamodharan8-Nov-12 19:00 
QuestionBad design? Pin
Daniel Sheets8-Nov-12 8:01
Daniel Sheets8-Nov-12 8:01 
AnswerRe: Bad design? Pin
Eddy Vluggen8-Nov-12 8:38
professionalEddy Vluggen8-Nov-12 8:38 
GeneralRe: Bad design? Pin
Matt T Heffron8-Nov-12 9:02
professionalMatt T Heffron8-Nov-12 9:02 
GeneralRe: Bad design? Pin
Daniel Sheets8-Nov-12 9:36
Daniel Sheets8-Nov-12 9:36 
AnswerRe: Bad design? Pin
fjdiewornncalwe8-Nov-12 9:28
professionalfjdiewornncalwe8-Nov-12 9:28 
AnswerRe: Bad design? Pin
SledgeHammer018-Nov-12 10:24
SledgeHammer018-Nov-12 10:24 
AnswerRe: Bad design? Pin
Clifford Nelson9-Nov-12 7:57
Clifford Nelson9-Nov-12 7:57 
GeneralRe: Bad design? Pin
Sheets.d9-Nov-12 8:04
Sheets.d9-Nov-12 8:04 
GeneralRe: Bad design? Pin
Clifford Nelson9-Nov-12 22:27
Clifford Nelson9-Nov-12 22:27 
GeneralMemory Stream Pin
Kushina8-Nov-12 7:04
Kushina8-Nov-12 7:04 
GeneralRe: Memory Stream Pin
Kushina8-Nov-12 7:05
Kushina8-Nov-12 7:05 
GeneralRe: Memory Stream Pin
jschell8-Nov-12 8:43
jschell8-Nov-12 8:43 
GeneralRe: Memory Stream Pin
Kushina9-Nov-12 9:58
Kushina9-Nov-12 9:58 
QuestionTotal hack - but is it OK? Pin
harold aptroot8-Nov-12 4:58
harold aptroot8-Nov-12 4:58 
AnswerRe: Total hack - but is it OK? Pin
Dave Kreskowiak8-Nov-12 6:37
mveDave Kreskowiak8-Nov-12 6:37 
AnswerRe: Total hack - but is it OK? Pin
SledgeHammer018-Nov-12 6:43
SledgeHammer018-Nov-12 6:43 
GeneralRe: Total hack - but is it OK? Pin
BobJanova8-Nov-12 23:18
BobJanova8-Nov-12 23:18 
AnswerRe: Total hack - but is it OK? Pin
Eddy Vluggen8-Nov-12 8:47
professionalEddy Vluggen8-Nov-12 8:47 
harold aptroot wrote:
This is a total hack, obviously. But is it OK? Assuming it isn't given bad indexes, can it fail somehow?

Not much exceptions that are thrown by those functions, according to MSDN. You might want to check whether the topic 'verification' from this page[^] applies to your situation.

No, wouldn't call it a hack, but emitting code is not a widely-understood topic; so you might wanna document what you did there. An implementation that 'generates' the required switch-code and compiling that with the built-in mechanism would be more familiar - also a bit slower, but I doubt that the layout of the class will change often, so it'd be a matter of compiling once and re-using the existing thing.

I'd go for reflection, as mentioned by others. Caching the results might improve speed there, but it's fast enough for most tasks without additional caching.
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]
They hate us for our freedom![^]

GeneralRe: Total hack - but is it OK? Pin
harold aptroot8-Nov-12 9:05
harold aptroot8-Nov-12 9:05 

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.