|
Il presente articolo è stato tradotto automaticamente. Passare il puntatore sulle frasi nell'articolo per visualizzare il testo originale. Ulteriori informazioni.
|
Traduzione
Originale
|
Metodo Convert.ToString (Byte)
.NET Framework 4.5
Spazio dei nomi: System
Assembly: mscorlib (in mscorlib.dll)
Parametri
- value
- Tipo: System.Byte
Intero senza segno a 8 bit da convertire.
public void ConvertStringByte(string stringVal) { byte byteVal = 0; try { byteVal = System.Convert.ToByte(stringVal); System.Console.WriteLine("{0} as a byte is: {1}", stringVal, byteVal); } catch (System.OverflowException) { System.Console.WriteLine( "Conversion from string to byte overflowed."); } catch (System.FormatException) { System.Console.WriteLine( "The string is not formatted as a byte."); } catch (System.ArgumentNullException) { System.Console.WriteLine( "The string is null."); } //The conversion from byte to string is always valid. stringVal = System.Convert.ToString(byteVal); System.Console.WriteLine("{0} as a string is {1}", byteVal, stringVal); }
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.