From the link :
The keyword is causes a compile-time warning if the expression is always known.
I tried to create an example:
class MyClass { public void method(MyClass c) { if (c is MyClass) { //... } if (c is Object) { //... } } }
But I do not receive any warnings. Why?
Can someone show me an example where I get a warning (because the expression is always true)?
It works for false.
The statement iswill return false if the value null, so if you call method(null), it will not be included in either if-block.
is
null
method(null)
if
However, if they MyClasswere actually struct(i.e. are not null), this will lead to a warning.
MyClass
struct
Source: https://habr.com/ru/post/1532329/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1532324/passing-parameters-to-ng-clicks-function-in-angularjs&usg=ALkJrhhvmIwvaZ1OaRVDv4PBjEooxcEVywКак легко обрабатывать CSV файл в список - javaWarning jsfiddle - phising in chrome - google-chromeHow to make DateTime.TryParse () fail if year is not specified? - c #Does mmap fit a page or part of a page? - c ++How to simulate ActionFilter attribute in Asp.net web form - c #Python SqlAlchemy insert ARRAY (postgres) with NULL values impossible? - pythonMultidimensional array With a NULL element inside an internal array - pythonEquivalent to wxPython freeze and push away in PyQt / PySide - pythonprove that coldfusion functions are unnecessarily buffer with output = true - performanceAll Articles