using System.Collections.Generic;
using System.ComponentModel;
public record Item(long Number, IEnumerable<string> OtherData);
static void Main(string[] args)
File.WriteAllText("file.txt", "1 677492 12Тм_54 Допол\r\n1 Привет 76 1з\r\n7 654 Это Твоё\r\n2 Тестовое -=-=-= СимволыИлиНет?\r\n0 Задание ЉµЉ 1787_-_?\r\n2147483747 Удачи На_полях Правосудия");
var items = LoadItemsFromFile("file.txt");
foreach (var item in items.OrderBy(x => x.Number))
DefineItemTypeAndWrite(item);
private static IEnumerable<Item> LoadItemsFromFile(string path)
=> File.ReadAllLines(path).Select(x =>
return new Item(long.Parse(data[0]), data.Skip(1));
private static Type[] types = new[]
typeof(sbyte), typeof(byte),
typeof(short), typeof(ushort),
typeof(int), typeof(uint),
typeof(long), typeof(ulong),
typeof(float), typeof(double), typeof(decimal),
private static void DefineItemTypeAndWrite(Item item)
Console.Write($"№: {item.Number} ");
foreach (string data in item.OtherData)
var type = types.FirstOrDefault(x => TypeDescriptor.GetConverter(x)?.IsValid(data) == true) ?? typeof(string);
Console.Write($" {data} - {type.Name}");