Notiz
Zougrëff op dës Säit erfuerdert Autorisatioun. Dir kënnt probéieren, Iech unzemellen oder Verzeechnesser ze änneren.
Zougrëff op dës Säit erfuerdert Autorisatioun. Dir kënnt probéieren, Verzeechnesser ze änneren.
Constant value 'value' cannot be converted to a 'type'.
An attempt was made to assign a value to a variable whose type cannot store the value. For more information, see Types.
The following sample generates CS0031 in both checked and unchecked contexts:
// CS0031.cs
namespace CS0031
{
public class Program
{
public static void Main()
{
int num = (int)2147483648M; //CS0031
// Try using a larger numeric type instead.
// long num = (long)2147483648M; //CS0031
const decimal d = -10M; // Decimal literal
unchecked
{
const byte b = (byte)d; // CS0031
// For small values try using a signed byte instead.
// const sbyte b = (sbyte)d;
}
}
}
}
See also
Schafft mat eis op GitHub zesummen
D'Quell fir dësen Inhalt kann op GitHub fonnt ginn, wou Dir och Theeme schafen an iwwerpréiwen kënnt an Ufroen unhuele kënnt. Fir méi Informatiounen, gitt op eisen Auteur-Guide.