русский
Germany.ruForen → Архив Досок→ Programmierung

Какой смысл арифметических операций с нулем?

18.06.23 20:05
Re: Какой смысл арифметических операций с нулем?
 
AlexNek патриот
AlexNek
in Antwort AlexNek 18.06.23 13:47

Похоже нашлось

http://zuga.net/articles/cs-what-are-lifted-operators/


  int? ten = 10;
  int? twenty = 20;
  // result.Value is 30
  int? result = ten + twenty;

Without lifted operators, the compiler would report:
Error CS0019 Operator '+' cannot be applied to operands of type 'Nullable<int>' and 'Nullable<int>'.


Но проблемы доставляют

https://mfranc.com/blog/something-null-is-false-c-and-lift...


if (data.CreateDate => this.LastUpdateDate)
{
     DoSomething();
}
 

Sprung zu