As the question shows, what does the following code mean?
public void blabla (bool? isActive = false) { }
Well, this is the void method (returns nothing), taking the optional parameter ( isActive = false ) with a boolean value of zero ( bool? ), Where the default value is false.
isActive = false
bool?
This is a public method, meaning that code that has access to the class / structure containing this method can see this method. public is called an access modifier.
public
Access Modifiers:
http://msdn.microsoft.com/en-us/library/wxh6fsc7(v=VS.100).aspx
Extra options:
http://msdn.microsoft.com/en-us/library/dd264739.aspx
Impossible types:
http://msdn.microsoft.com/en-us/library/1t3y8s4s(v=VS.100).aspx
As for this value, it depends on whether he is responsible for maintaining the aircraft in the air or not: -P
bool? indicates that it is a null type that supports true , false or null . = false indicates that if no value is specified, this is false , which is the default value.
null
true
false
= false
its optional parameter with a null boolean value with a default value of false
This makes bool a type with a null value:
See: http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx
This means that it creates a new method, and a parameter with the value DEFAULT means that you can call it in two ways:blabla(true); or blabla(false) or blabla(null)or:blabla() and this will give the default value FALSE.
blabla(true);
blabla(false)
blabla(null)
blabla()