Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ReadInt_04
- {
- class Program
- {
- static void Main(string[] args)
- {
- int number = 0;
- ReadInt(ref number);
- Console.Write($"Возвращение сконвертированного числа через out number: ");
- Console.WriteLine(number);
- }
- static void ReadInt(ref int number)
- {
- bool exit = false;
- while (exit == false)
- {
- Console.Write($"Введите число: ");
- bool result = int.TryParse(Console.ReadLine(), out number);
- if (result)
- {
- exit = true;
- }
- else
- {
- Console.WriteLine($"это не число");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement