mardi 25 août 2020

C# CustomAttributeData class to attribute

I have the following code located in a Swashbuckle.Swagger.IOperationFilter class.

List<CustomAttributeData> controllerAttributes = apiDescription
    .ActionDescriptor
    .ControllerDescriptor
    .ControllerType
    .CustomAttributes
    .Where(a => a.AttributeType == typeof(SwaggerFileInFormDataAttribute))
    .ToList();

I am obtaining the collection successfully. I want to convert the collection into a collection of my custom attribute List<SwaggerFileInFormDataAttribute>.

enter image description here

I want to convert the System.Reflection.CustomAttributeData class to my custom attribute SwaggerFileInFormDataAttribute.





Aucun commentaire:

Enregistrer un commentaire