private static object NormalizeArg()

in src/Microsoft.NET.Sdk.Functions.Generator/TypeUtility.cs [160:180]


        private static object NormalizeArg(CustomAttributeArgument arg)
        {
            if (arg.Type.IsArray)
            {
                var arguments = arg.Value as CustomAttributeArgument[];
                Type arrayType = arg.Type.GetElementType().ToReflectionType();
                var array = Array.CreateInstance(arrayType, arguments.Length);
                for (int i = 0; i < array.Length; i++)
                {
                    array.SetValue(arguments[i].Value, i);
                }
                return array;
            }

            if (arg.Value is TypeDefinition typeDef)
            {
                return typeDef.ToReflectionType();
            }

            return arg.Value;
        }