jeudi 11 août 2016

Visual studio cast is redundant when passing arguments using reflection

With this line of code, VS20125 shows "Cast is redundant" for both arguments (but works!!).

Activator.CreateInstance(type, (IOperationContext)null, (Dictionary<string, object>)null);

Whereas if I remove them I get:

Activator.CreateInstance(type, null, null);

It throws "System.MissingMethodException" exception:

Constructor on type 'iBI.Services.Hsd.Operations.Schedule.RefreshUsedOperation' not found.

Is there something wrong with the usage or this is just false alram by visual studio?





Aucun commentaire:

Enregistrer un commentaire