Fun With Named Formats, String Parsing, and Edge Cases

Posted by: youve been HAACKED, on 05 Jan 2009 | View original | Bookmarked: 0 time(s)

Recently I found myself in a situation where I wanted to format a string using a named format string, rather than a positional one. Ignore for the moment the issue on whether this is a good idea or not, just trust me that Ill be responsible with it. The existing String.Format method, for example, formats values according to position. string s = string.Format("{0} first, {1} second", 3.14, DateTime.Now); But what I wanted was to be able to use the name of properties/fields, rather...

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: Regex | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 877 | Hits: 28

Similar Posts

  • Filtering with string parameter that allows free user input more
  • LINQ Tip of the week: System.String support more
  • UppercuT - Automated Builds - Test Category Filters more
  • Validation - Part 2 - Client-Side more
  • Validation - Part 1 - Getting Started more
  • ORM Release History : Q1 2009 SP1 (version 2009.1.405.1) more
  • Showing Syntax Colored Source Code in ASP.NET Content more
  • Using Enums in List Controls more
  • Back to CSV - Convert CSV text to Objects; via JSON more
  • Render Control as String more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD