Created
January 31, 2012 14:02
-
-
Save samandmoore/1710637 to your computer and use it in GitHub Desktop.
Umbraco v5 MacroParameters default value
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
@functions { | |
object MacroParamValueOrDefault(dynamic paramValue, object defaultValue = null) | |
{ | |
if(string.IsNullOrEmpty(paramValue)) { | |
return defaultValue; | |
} else { | |
return paramValue; | |
} | |
} | |
} | |
@* usage... *@ | |
@{ | |
int x = Convert.ToInt32(MacroParamValueOrDefault(Model.MacroParameters.maxLevel, defaultValue: 8)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment