private static object GetAttributeArgument(string attributeName, CustomAttributeData attribute, int index) { var arguments = attribute.GetConstructorArguments(); if (arguments.Count < index) { // Use default. return(null); } return(arguments[index].Value); }