|
Il presente articolo è stato tradotto automaticamente. Passare il puntatore sulle frasi nell'articolo per visualizzare il testo originale. Ulteriori informazioni.
|
Traduzione
Originale
|
Campo Int32.MaxValue
.NET Framework 4.5
Spazio dei nomi: System
Assembly: mscorlib (in mscorlib.dll)
long[] numbersToConvert = { 162345, 32183, -54000, Int64.MaxValue/2 }; int newNumber; foreach (long number in numbersToConvert) { if (number >= Int32.MinValue && number <= Int32.MaxValue) { newNumber = Convert.ToInt32(number); Console.WriteLine("Successfully converted {0} to an Int32.", newNumber); } else { Console.WriteLine("Unable to convert {0} to an Int32.", number); } } // The example displays the following output to the console: // Successfully converted 162345 to an Int32. // Successfully converted 32183 to an Int32. // Successfully converted -54000 to an Int32. // Unable to convert 4611686018427387903 to an Int32.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (ruoli di base del server non supportati), Windows Server 2008 R2 (ruoli di base del server supportati con SP1 o versione successiva, Itanium non supportato)
.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.