Home > Net >  This how take out the "int?" To cast the "int"
This how take out the "int?" To cast the "int"

Time:10-04

For help, I just learn c #, this how take out "int?" How to solve?

CodePudding user response:

I will not when he is EF strange, model and database does not match

CodePudding user response:

Int suxing=entity. GetMapType (XXXXXXXXX). The Value;

CodePudding user response:

Two kinds of writing:

Int suxing=entity. GetMapType (... ) ?? 0 ;
Or
Int suxing=entity. GetMapType (... )?? Throw new InvalidOperationException (" wrong ");

CodePudding user response:

Int? Can be equal to null, you behind the code of the return value may be allowed to empty, you put int int suxing changed? Suxing try

CodePudding user response:

Int? And int

CodePudding user response:

Nullable types of abbreviated type



CodePudding user response:

Int? Is a Nullable type, type int is Int32, of course not the same

CodePudding user response:

Int? Can not allow null values, int

CodePudding user response:

If that is not null can also be used its Value attribute

CodePudding user response:

Int? Behind the code allows null type int int suxing method return values may be null, so the compiler error,

CodePudding user response:

Int type cannot be introduced to null values, but int? Can pass in null values
Actually the int? Is the Nullable
Can be null
But simplified

CodePudding user response:

Int? a=1;
Int b=Dr. Alue.

A is Null when complains so need to determine whether once to obtain the value of the first to Null

CodePudding user response:

Try to convert an int, the parse

CodePudding user response:

May be there is something wrong with the value of the variable transmission, try to pass a value to him,

CodePudding user response:

Int? As a nullable type int, c # is the new version features
  •  Tags:  
  • C#
  • Related