示例#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="ManagedClusterAddonProfile" />.</param>
 /// <returns>
 /// an instance of <see cref="ManagedClusterAddonProfile" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public static Microsoft.Azure.PowerShell.Cmdlets.Aks.Models.Api20200901.IManagedClusterAddonProfile ConvertFrom(dynamic sourceValue)
 {
     if (null == sourceValue)
     {
         return(null);
     }
     global::System.Type type = sourceValue.GetType();
     if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Aks.Models.Api20200901.IManagedClusterAddonProfile).IsAssignableFrom(type))
     {
         return(sourceValue);
     }
     try
     {
         return(ManagedClusterAddonProfile.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString()));;
     }
     catch
     {
         // Unable to use JSON pattern
     }
     if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
     {
         return(ManagedClusterAddonProfile.DeserializeFromPSObject(sourceValue));
     }
     if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
     {
         return(ManagedClusterAddonProfile.DeserializeFromDictionary(sourceValue));
     }
     return(null);
 }