c# - Selecing an overloaded method using 'Named arguments' -
i want use 'named arguments' feature parameter.
there 2 methods.
class temp { public method(class1 param); public method(class2 param); };
in case of above class, if want call method using 'named arguments'. can call method(param: 'some value');
, want give null
in 'some value', when try this,
method(param:null);
i see message
the call ambiguous between following methods or properties: 'method' , 'method'
then, realized these 2 (class1, class2) similar.
so when try cast this,
method((class1)param:null);
i failed message below.
the name 'identifier' not exist in current context
so can 'cast' 'param' parameter?
thank you.
you this:
methodname(param: (class1)null)
basically, need cast null
given type, not parameter
Comments
Post a Comment