/// <summary> /// Forces approximate ducking around a dictionary. Will "create" underlying /// "properties" as required. Will attempt to convert to and from the underlying /// types as required. Will match properties case-insensitive. /// </summary> /// <param name="src"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> public static T ForceFuzzyDuckAs <T>(this object src) { return(Shared.ForceDuckAs <T>( src, true, true)); }
/// <summary> /// Forces approximate ducking around a dictionary. Will "create" underlying /// "properties" as required. Will attempt to convert to and from the underlying /// types as required. Will match properties case-insensitive. /// </summary> /// <param name="src"></param> /// <param name="forceConcreteType">force ducking when T is concrete without virtual/abstract members</param> /// <typeparam name="T"></typeparam> /// <returns></returns> public static T ForceFuzzyDuckAs <T>( this IDictionary <string, object> src, bool forceConcreteType ) { return(Shared.ForceDuckAs <T>(src, true, true, forceConcreteType)); }
/// <summary> /// Forces ducking around a dictionary. This will expect matching of property /// names (case-sensitive) and types when they are "implemented". Otherwise they /// will be created as required. /// </summary> /// <param name="src"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> public static T ForceDuckAs <T>(this IDictionary <string, object> src) { return(Shared.ForceDuckAs <T>(src, false, true)); }