Created
March 24, 2014 08:53
-
-
Save FransBouma/9736633 to your computer and use it in GitHub Desktop.
Even with 20+ years of development experience, Monday mornings are hard...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object newValueInType = newValue; | |
string newValueAsString = newValue as string; | |
if(type == typeof(DateTimeOffset)) | |
{ | |
newValueInType = DateTimeOffset.Parse(newValueAsString); | |
} | |
if(type == typeof(Guid)) | |
{ | |
newValueInType = Guid.Parse(newValueAsString); | |
} | |
if(type == typeof(TimeSpan)) | |
{ | |
newValueInType = TimeSpan.Parse(newValueAsString); | |
} | |
else | |
{ | |
newValueInType = Convert.ChangeType(newValue, type); | |
} | |
_defaultsPerType[type] = newValueInType; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cant agree more with you about Monday.