/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
docs/fundamentals/runtime-libraries/snippets/System/Boolean/Overview/csharp/conversion3.cs
32 строки
737 B
Genevieve Warren
Add remarks for core types (#38970)
05 янв 2024, 22:14
Не верифицирован
05 янв 2024, 22:14
71d1377
Код
Авторство
О чём код?
// <Snippet8> using System; public class Example3 { public static void Main() { bool flag = true; byte byteValue; byteValue = Convert.ToByte(flag); Console.WriteLine("{0} -> {1}", flag, byteValue); sbyte sbyteValue; sbyteValue = Convert.ToSByte(flag); Console.WriteLine("{0} -> {1}", flag, sbyteValue); double dblValue; dblValue = Convert.ToDouble(flag); Console.WriteLine("{0} -> {1}", flag, dblValue); int intValue; intValue = Convert.ToInt32(flag); Console.WriteLine("{0} -> {1}", flag, intValue); } } // The example displays the following output: // True -> 1 // True -> 1 // True -> 1 // True -> 1 // </Snippet8>