This file contains 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
public void DoStuff(object input) | |
{ | |
if (input == null) | |
throw new ArgumentNullException("input"); | |
// Method implementation... | |
} |
This file contains 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
public static class AttributeExtensions | |
{ | |
// Attribute.IsDefined shortcuts | |
public static bool HasAttribute<T>(this object element) where T : Attribute | |
{ return Attribute.IsDefined(element.GetType(), typeof(T)); } | |
public static bool HasAttribute<T>(this object element, bool inherit) where T : Attribute | |
{ return Attribute.IsDefined(element.GetType(), typeof(T), inherit); } | |
public static bool HasAttribute<T>(this Assembly element) where T : Attribute | |
{ return Attribute.IsDefined(element, typeof(T)); } | |
public static bool HasAttribute<T>(this Assembly element, bool inherit) where T : Attribute |
This file contains 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
<system.serviceModel> | |
<services> | |
<service name="Example.ProblemService" behaviorConfiguration="CustomBehavior"> | |
<endpoint contract="Example.IProblemService" binding="wsHttpBinding" bindingConfiguration="ssl" /> | |
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/> | |
</service> | |
</services> | |
<bindings> | |
<wshttpbinding> |
This file contains 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 dynamic CreateDynamicFromObjectGraph(object input) | |
{ | |
if(input is IDictionary<string, object>) | |
{ | |
var result = (IDictionary<string, object>)(new ExpandoObject()); | |
foreach (var pair in (IDictionary<string, object>)input) | |
result.Add(pair.Key, CreateDynamicFromObjectGraph(pair.Value)); | |
return result; |