c# - Optional parameters - specify one out of several -


i have method accepts 3 optional parameters.

public int dostuff(int? count = null, bool? isvalid = null, string name = "default") {     //do } 

my question is, if call method , pass single method argument:

var isvalid = true; dostuff(isvalid); 

i the following error:

argument 1: cannot convert 'bool' 'int?'

is possible pass single method argument, , specify parameter wish specify?

since first parameter count, expecting int? not bool.

you can provide named parameters describes here.

dostuff(isvalid: true); 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -