Created
October 29, 2013 15:41
-
-
Save killnine/7217112 to your computer and use it in GitHub Desktop.
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
| private static void FindAndConvertParameter<R, T>(IList<R> parameters, string name, out T value) where R : ApplicationParameterDto | |
| { | |
| value = default(T); | |
| ApplicationParameterDto parameter = ((List<R>) parameters).Find(dto => dto.Name.Trim().ToUpper() == name.Trim().ToUpper()); | |
| if (parameter != null && !String.IsNullOrWhiteSpace(parameter.Value)) | |
| { | |
| try | |
| { | |
| if (typeof(T).IsEnum) | |
| { | |
| value = (T)Enum.Parse(typeof(T), parameter.Value); | |
| } | |
| ... | |
| } | |
| catch(Exception ex) | |
| { | |
| //TODO: Handle issues... | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment