William Duffy

Glasgow Based ASP.NET Web Developer

Tag archive for ‘Strings’

Parsing dates when ASP.NET’s DateTime.Parse doesn’t work

Has DateTime.Parse ever thrown the following exception when you passed it a legally formatted value, leaving you bemused as to why it can’t parse it?
String was not recognized as a valid DateTime
As powerful as DateTime.Parse is, it cannot handle every representation of a date/time value without a little help from you, the developer.
External sources [...]

Coalesce: ASP.NET Strings

In programming it is a common occurrence to have a list of possiblities from which you would like the first available option selected. SQL Server has a handy method (Coalesce) which makes performing this easy, but unless you are using nullable types .NET does not have a suitable alternative. Here, I will make a helper [...]