Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does bool? isActive = false mean in c#?

Tags:

c#

boolean

As the question depicts, what does the following code mean?

public void blabla (bool? isActive = false) {

}
like image 945
Shaokan Avatar asked Dec 03 '22 01:12

Shaokan


1 Answers

Well, it is a void method (returns nothing) taking an optional parameter (isActive = false) of a nullable boolean (bool?), where the default value is false.

It is a public method, meaning that code that has access to the class / struct that contains this method can see the method. The public is called an access modifier.

Access modifiers:

http://msdn.microsoft.com/en-us/library/wxh6fsc7(v=VS.100).aspx

Optional parameters:

http://msdn.microsoft.com/en-us/library/dd264739.aspx

Nullable types:

http://msdn.microsoft.com/en-us/library/1t3y8s4s(v=VS.100).aspx

As for it's significance, that depends if it's responsible for keeping planes in the air or not :-P

like image 194
Adam Houldsworth Avatar answered Dec 11 '22 09:12

Adam Houldsworth