How good is the C # type conclusion? I have read somewhere that this is only for local variables? Does it work for class-level qualities? To sign the law? Method of withdrawal? C #:
Some main types of conclusions C #:
-
Local variables typed illegally:
- For local variables only
- Only when the declaration is assigned as part of the declaration < Li> Price can not be zero
- Value can be of lambda expression, benami method or law group (without any artist)
- Use compile-time type of value type Variable is used for
- Any other uses of the variable are only checking against the type specified by the initial declaration + defining; They do not contribute to the conclusions themselves.
-
General method type argument conclusion, i.e. you do not specify type arguments in the call of a common method, the compiler shows them based on logic.
- Along with normal types, it will be really easy for normal way
- Acting in any way in reality - LINQ will
- its
- There are very complex rules, even in some places the idea is wrong
- / Li>
-
Lambda expression parameter type estimate
- Compiler lambda expression based on that context Trying to fulfill the type of parameters in which it is used
- generally works very well in my experience
-
Array type estimates, e.g.
new [] {"hi", "there"}
instead ofnew string [] {"hi", "there"}
- Many small restrictions, nothing big
I have probably forgotten some other features which can be called "type guess". I suspect that you are more interested in the past, but others may also be relevant to you :)
Comments
Post a Comment