Creating method in C #, where do the parameters contain? [duplicate]

0

What's the use of adding "?" the front of the parameter variable? Example:

public void somar(int n1, Date data?){

}

OR

public void somar(int n1, Date? data){

}
    
asked by anonymous 06.10.2017 / 18:28

1 answer

1

This interrogation allows the field to receive a null value. For example when declaring something like this:

int i;

By default it will be given a value of zero when we declare:

int? i;

It defaults to null.

Nullable Types

Types that allow null value can represent all values of an underlying type and an additional value null.

Source: link

    
06.10.2017 / 18:34