Информация об изменениях

Сообщение Re: { } от 26.10.2023 16:31

Изменено 27.10.2023 1:34 Sinclair

Re: { }
Здравствуйте, BlackEric, Вы писали:

BE>Я сейчас глупость спрошу, но зачем в коде


BE>
BE>if (stage() is { } stages)
BE>

BE>{ }, что они означают?
Это — property pattern с пустым списком пропертей.
Эквивалентно проверке на not null:

To check if the string s is non-null, you can write any of the following forms

if (s is object o) ... // o is of type object
if (s is string x) ... // x is of type string
if (s is {} x) ... // x is of type string
if (s is {}) ...

BE>stage возвращает List<Stage>. Stages имеет этот же тип.
Подозреваю, что это — ан
Re: { }
Здравствуйте, BlackEric, Вы писали:

BE>Я сейчас глупость спрошу, но зачем в коде


BE>
BE>if (stage() is { } stages)
BE>

BE>{ }, что они означают?
Это — property pattern с пустым списком пропертей.
Эквивалентно проверке на not null:

To check if the string s is non-null, you can write any of the following forms

if (s is object o) ... // o is of type object
if (s is string x) ... // x is of type string
if (s is {} x) ... // x is of type string
if (s is {}) ...

BE>stage возвращает List<Stage>. Stages имеет этот же тип.