Click here to Skip to main content
12,700,201 members (36,245 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked

.Net - Use The Framework

, 6 Apr 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
The following is far easier to understand and use than the Outlaw's tip (IMHO).text = Regex.Replace(text, "screen_fadetimeout=\"[^\"\']+\"", "screen_fatetimeout="99");It has the following advantages:1. It is one line of code2. It is easier to read3. It is faster (note: XmlElement...
The following is far easier to understand and use than the Outlaw's tip (IMHO).

text = Regex.Replace(text, "screen_fadetimeout=\"[^\"\']+\"", "screen_fatetimeout="99");

It has the following advantages:
1. It is one line of code
2. It is easier to read
3. It is faster (note: XmlElement uses Regex in it's implementation) and further speed can be gained by using a compiled Regex instance.
4. No need to worry about null references (what if the desired element doesn't exist?)
5. It is light compared to XmlElement.Parse()
6. If you need to know if the item was found, you can use the MatchEvaluator overload and an anonymous delegate -- still one line of code.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralReason for my vote of 4 4 - I see nothing wrong in your solu... Pin
johannesnestler24-Feb-12 1:56
memberjohannesnestler24-Feb-12 1:56 
GeneralReason for my vote of 2 Isn't you find John Simmons's way wi... Pin
Pranit Kothari8-Jan-12 5:20
memberPranit Kothari8-Jan-12 5:20 
GeneralIt's not about what I did - it's about why I did it. Pin
John Simmons / outlaw programmer22-May-10 4:14
mvpJohn Simmons / outlaw programmer22-May-10 4:14 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170118.1 | Last Updated 6 Apr 2010
Article Copyright 2010 by TheGreatAndPowerfulOz
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid