private static object Map(object providedValue, Type type) { if (providedValue == null) { return(null); } if (providedValue.GetType().IsArray) { return(ArrayParam <IParam> .FromObject(providedValue)); } // Usually providedValue contains all needed type information, // but in case of F# enum types in attributes are erased. // We can to restore them from types of arguments and fields. // See also: // https://github.com/dotnet/fsharp/issues/995 else if (providedValue.GetType().IsEnum || type.IsEnum) { return(EnumParam.FromObject(providedValue, type)); } return(providedValue); }