Click here to Skip to main content
15,886,026 members
Home / Discussions / C#
   

C#

 
GeneralRe: Just for the fun of it... Pin
harold aptroot12-Sep-14 22:19
harold aptroot12-Sep-14 22:19 
GeneralRe: Just for the fun of it... Pin
Rob Philpott13-Sep-14 0:24
Rob Philpott13-Sep-14 0:24 
GeneralRe: Just for the fun of it... Pin
harold aptroot13-Sep-14 0:28
harold aptroot13-Sep-14 0:28 
GeneralRe: Just for the fun of it... Pin
Rob Philpott13-Sep-14 1:02
Rob Philpott13-Sep-14 1:02 
QuestionMail sending in c# Pin
vidhyankr11-Sep-14 19:51
professionalvidhyankr11-Sep-14 19:51 
SuggestionRe: Mail sending in c# Pin
Richard MacCutchan11-Sep-14 21:34
mveRichard MacCutchan11-Sep-14 21:34 
AnswerRe: Mail sending in c# Pin
challa naresh kumar reddy12-Sep-14 1:50
challa naresh kumar reddy12-Sep-14 1:50 
QuestionAny suggestions for "compiling" strings? Pin
SledgeHammer0111-Sep-14 14:32
SledgeHammer0111-Sep-14 14:32 
I have a mini macro language for my application. Something along the lines of:

"Blah -- [SomeTag:SomeParam=SomeValue] -- Blah. Blah, Blah : [SomeTag2:SomeParam2=SomeValue2]"

So, my current implementation parses the string every time my method gets called, does error checking every time, etc. I parse the string with Regex group matching and then do a String.Replace() on the string to replace the macros with the resolved macro strings.

I get called many times with the same format string, but different parameters.

It doesn't really make sense to parse and error check, etc. every time. That'll be a performance hit. Especially with Regex.

How do people typically "compile" the string for tasks like this?

My first idea was to parse and error check the string the first time and replace the macros with a compact fixed string. For example, in the case above, the first time I would compile to:

"Blah -- $A1 -- Blah. Blah, Blah : $B1"

Then I would know that command $A1 means do SomeTag in SomeParam=SomeValue mode. $A2 would mean do SomeTag in SomeParam=SomeValue2 mode. SomeTag2 would be $B1, etc.

This would save me the regex and error checking every time. I would still have to do String.Replace() of course...

The tag operations are not static constants BTW, they come from various places.

Any other ideas?
AnswerRe: Any suggestions for "compiling" strings? Pin
PIEBALDconsult11-Sep-14 15:36
mvePIEBALDconsult11-Sep-14 15:36 
GeneralRe: Any suggestions for "compiling" strings? Pin
SledgeHammer0111-Sep-14 16:02
SledgeHammer0111-Sep-14 16:02 
GeneralRe: Any suggestions for "compiling" strings? Pin
SledgeHammer0111-Sep-14 19:37
SledgeHammer0111-Sep-14 19:37 
AnswerRe: Any suggestions for "compiling" strings? Pin
Pete O'Hanlon11-Sep-14 22:38
mvePete O'Hanlon11-Sep-14 22:38 
AnswerRe: Any suggestions for "compiling" strings? Pin
jschell13-Sep-14 6:57
jschell13-Sep-14 6:57 
QuestionDatagridcombocell Problem Pin
hussainroyal11-Sep-14 10:39
hussainroyal11-Sep-14 10:39 
SuggestionRe: Datagridcombocell Problem Pin
Richard MacCutchan11-Sep-14 21:32
mveRichard MacCutchan11-Sep-14 21:32 
GeneralRe: Datagridcombocell Problem Pin
hussainroyal11-Sep-14 22:03
hussainroyal11-Sep-14 22:03 
QuestionGet a property from an internal .NET framework class Pin
Mc_Topaz11-Sep-14 4:20
Mc_Topaz11-Sep-14 4:20 
AnswerRe: Get a property from an internal .NET framework class Pin
Richard Deeming11-Sep-14 4:38
mveRichard Deeming11-Sep-14 4:38 
GeneralRe: Get a property from an internal .NET framework class Pin
Mc_Topaz11-Sep-14 4:46
Mc_Topaz11-Sep-14 4:46 
AnswerRe: Get a property from an internal .NET framework class Pin
Dave Kreskowiak11-Sep-14 4:45
mveDave Kreskowiak11-Sep-14 4:45 
AnswerRe: Get a property from an internal .NET framework class Pin
Eddy Vluggen11-Sep-14 5:20
professionalEddy Vluggen11-Sep-14 5:20 
GeneralRe: Get a property from an internal .NET framework class Pin
OriginalGriff11-Sep-14 5:29
mveOriginalGriff11-Sep-14 5:29 
GeneralRe: Get a property from an internal .NET framework class Pin
PIEBALDconsult11-Sep-14 6:19
mvePIEBALDconsult11-Sep-14 6:19 
GeneralRe: Get a property from an internal .NET framework class Pin
Eddy Vluggen11-Sep-14 6:51
professionalEddy Vluggen11-Sep-14 6:51 
GeneralRe: Get a property from an internal .NET framework class Pin
OriginalGriff11-Sep-14 8:50
mveOriginalGriff11-Sep-14 8:50 

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.