Пример #1
0
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the value to convert into an instance of <see cref="DatadogMonitorResource" />.</param>
 /// <returns>
 /// an instance of <see cref="DatadogMonitorResource" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public static Microsoft.Azure.PowerShell.Cmdlets.Datadog.Models.Api20210301.IDatadogMonitorResource ConvertFrom(dynamic sourceValue)
 {
     if (null == sourceValue)
     {
         return(null);
     }
     global::System.Type type = sourceValue.GetType();
     if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Datadog.Models.Api20210301.IDatadogMonitorResource).IsAssignableFrom(type))
     {
         return(sourceValue);
     }
     try
     {
         return(DatadogMonitorResource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString()));;
     }
     catch
     {
         // Unable to use JSON pattern
     }
     if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
     {
         return(DatadogMonitorResource.DeserializeFromPSObject(sourceValue));
     }
     if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
     {
         return(DatadogMonitorResource.DeserializeFromDictionary(sourceValue));
     }
     return(null);
 }