Click here to Skip to main content
15,928,207 members
Home / Discussions / C#
   

C#

 
QuestionSecond window behavior Pin
simplicitylabs11-May-07 6:08
simplicitylabs11-May-07 6:08 
AnswerRe: Second window behavior Pin
Miszou11-May-07 7:11
Miszou11-May-07 7:11 
GeneralRe: Second window behavior Pin
simplicitylabs11-May-07 7:27
simplicitylabs11-May-07 7:27 
Questionstatic methods urgent please Pin
netJP12L11-May-07 5:47
netJP12L11-May-07 5:47 
QuestionValidate an XML File in .NET 2.0 C# Pin
SABhatti11-May-07 5:37
SABhatti11-May-07 5:37 
QuestionEmulate Outlook To Field Pin
Gavin Roberts11-May-07 5:21
Gavin Roberts11-May-07 5:21 
AnswerRe: Emulate Outlook To Field Pin
Gavin Roberts13-May-07 21:59
Gavin Roberts13-May-07 21:59 
QuestionGenerating code from a string using c# Pin
Pete O'Hanlon11-May-07 4:35
mvePete O'Hanlon11-May-07 4:35 
Well, I've been wrestling with a problem for a little while now and feel like I'm banging my head against a brick wall. Basically, I want to be able to generate code from a string that can refer to a current instance member. This would mean that I would need to be able to inject it into the current instance.

Specifically I'm trying to attach the code to an attribute. Initially I attempted to do this with a delegate, but you can't attach delegates to attributes (which makes sense when you stop and think about it).

Consider this example:
SomeClass.Generate("return (this.Name != null && this.Name.Length.Trim() < 20);");
I've looked at the CodeDOM and I've looked at Reflection.Emit and I can't seem to find a way to do this.

If anybody else has attempted this, I would be really interested to hear how they managed it or if (as I'm starting to suspect) this is impossible.

Deja View - the feeling that you've seen this post before.

AnswerRe: Generating code from a string using c# Pin
Judah Gabriel Himango11-May-07 5:18
sponsorJudah Gabriel Himango11-May-07 5:18 
GeneralRe: Generating code from a string using c# Pin
Pete O'Hanlon11-May-07 8:29
mvePete O'Hanlon11-May-07 8:29 
GeneralRe: Generating code from a string using c# Pin
Judah Gabriel Himango11-May-07 11:35
sponsorJudah Gabriel Himango11-May-07 11:35 
AnswerRe: Generating code from a string using c# Pin
Daniel Grunwald13-May-07 2:40
Daniel Grunwald13-May-07 2:40 
GeneralRe: Generating code from a string using c# Pin
Pete O'Hanlon13-May-07 9:06
mvePete O'Hanlon13-May-07 9:06 
Questionurgent help required Pin
IrfanHaleem11-May-07 4:31
IrfanHaleem11-May-07 4:31 
AnswerStop naming all your messages with please/urgent Pin
leckey11-May-07 4:48
leckey11-May-07 4:48 
GeneralRe: Stop naming all your messages with please/urgent Pin
IrfanHaleem11-May-07 20:59
IrfanHaleem11-May-07 20:59 
AnswerRe: urgent help required Pin
Dave Kreskowiak11-May-07 5:22
mveDave Kreskowiak11-May-07 5:22 
GeneralRe: urgent help required Pin
Paul Conrad11-May-07 8:07
professionalPaul Conrad11-May-07 8:07 
GeneralRe: urgent help required Pin
Dave Kreskowiak11-May-07 9:09
mveDave Kreskowiak11-May-07 9:09 
GeneralRe: urgent help required Pin
Paul Conrad11-May-07 9:11
professionalPaul Conrad11-May-07 9:11 
AnswerRe: urgent help required Pin
Leslie Sanford11-May-07 6:38
Leslie Sanford11-May-07 6:38 
Questioninteraction with plugin! Pin
ashu.singh11-May-07 4:15
ashu.singh11-May-07 4:15 
QuestionCan you tell me How to Port C# application to Linux?? Pin
A . Ansari11-May-07 4:08
A . Ansari11-May-07 4:08 
AnswerRe: Can you tell me How to Port C# application to Linux?? Pin
Jimmanuel11-May-07 4:23
Jimmanuel11-May-07 4:23 
GeneralRe: Can you tell me How to Port C# application to Linux?? Pin
A . Ansari12-May-07 18:20
A . Ansari12-May-07 18:20 

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.