Чтобы узнать состояние соединения, нужно использовать метод isOpened(). Результат метода не отражает текущее состояние подключения - если с ККТ была разорвана связь, то метод все так же будет возвращать true, но методы, выполняющие какие-либо операции над ККТ, будут возвращать ошибку LIBFPTR_ERROR_NO_CONNECTION.
 
      set MyKey="My key from Environment"
set Position__Title=Environment_Editor
set Position__Name=Environment_Rick
dotnet run// из public class Startup
        public void ConfigureServices(IServiceCollection services)
        {
            services. Configure<PositionOptions>(Configuration.GetSection(
                                                PositionOptions.Position));
            services.AddRazorPages();
        }
// из кода, который обращается к настройкам
    public class PositionOptions
    {
        public const string Position = "Position";
        public string Title { get; set; }
        public string Name { get; set; }
    }
        public Test2Model(IOptions<PositionOptions> options)
        {
            _options = options.Value;
        }
        public ContentResult OnGet()
        {
            return Content($"Title: {_options.Title} \n" +
                           $"Name: {_options. Name}");
        }var title = Configuration["Position:Title"];
            var name = Configuration["Position:Name"];var query = _dbContext.Products.AsQueryable();
            if (request.ProductGroups?.Length > 0)
            {
                query = query.Where(x => request.ProductGroups.Any(y => y == x.ProductGroup));
            }
            if (request.SupplierIds?.Length > 0)
            {
                query = query.Where(x => request.SupplierIds.Any(y => y == x.SupplierId));
            }
            if (request.Categories?.Length > 0)
            {
                query = query.Where(x => request.Categories.Any( y => y == x.Category));
            }
            return Task.FromResult(_mapper.ProjectTo<ProductDto>(query));void change(string first, string second, string third)
        {
            if(label1 == null)
            {
                label1 = new Label();
                groupBox1.Controls.Add(label1);
            }
            label1.Text = questions[current];
        }
private Label label1 = null;xsd SourceFormat.xsd /c /n:NameSpace /o:tmp
cd tmp
ren SourceFormat.cs     SourceFormat.designer.cs
move /y SourceFormat.designer.cs ..
cd ..
rd /s/q tmpvar serializer = new XmlSerializer ( typeof ( nmaprun ) );
                using ( var writer = new StreamWriter ( xmlFileName ) ) )
                {
                    serializer.Serialize ( writer, item );
                    writer.Close ();
                }using ( var temp = new StringReader ( xmlText ) )
                    {
                        var tmp = serializer.Deserialize ( temp );
                        return ( nmaprun ) tmp;
                    }