Update Test Site
+ Localized everything - No external resources required on the front-end + `test123` tested Layouts with relative paths.. issue is, its always relative from root
This commit is contained in:
24
WebServer/Extensions/ExpandoObject.cs
Normal file
24
WebServer/Extensions/ExpandoObject.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Text;
|
||||
|
||||
namespace WebServer.Extensions {
|
||||
public static class ExpandoObjectExt {
|
||||
public static object GetPropertyOrDefault(this ExpandoObject expando, string propertyName, object defaultValue) {
|
||||
if (expando is IDictionary<string, object> dict) {
|
||||
if (!dict.TryGetValue(propertyName, out var result))
|
||||
dict.Add(propertyName, result = defaultValue);
|
||||
return result;
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public static bool TryGetProperty(this ExpandoObject expando, string propertyName, out object value) {
|
||||
value = null;
|
||||
return expando is IDictionary<string, object> dict
|
||||
&& dict.TryGetValue(propertyName, out value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user