/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
docs/fundamentals/runtime-libraries/snippets/System/Boolean/Overview/csharp/conversion1.cs
32 строки
841 B
Genevieve Warren
Add remarks for core types (#38970)
05 янв 2024, 22:14
Не верифицирован
05 янв 2024, 22:14
71d1377
Код
Авторство
О чём код?
// <Snippet6> using System; public class Example2 { public static void Main() { Byte byteValue = 12; Console.WriteLine(Convert.ToBoolean(byteValue)); Byte byteValue2 = 0; Console.WriteLine(Convert.ToBoolean(byteValue2)); int intValue = -16345; Console.WriteLine(Convert.ToBoolean(intValue)); long longValue = 945; Console.WriteLine(Convert.ToBoolean(longValue)); SByte sbyteValue = -12; Console.WriteLine(Convert.ToBoolean(sbyteValue)); double dblValue = 0; Console.WriteLine(Convert.ToBoolean(dblValue)); float sngValue = .0001f; Console.WriteLine(Convert.ToBoolean(sngValue)); } } // The example displays the following output: // True // False // True // True // True // False // True // </Snippet6>