Implicitly Typed Arrays
As explained in Chapter 3, C# 3.0 adds the ability to declare implicitly typed variables by
using the
var
keyword. These are variables whose type is determined by the compiler, based
on the type of the initializing expression. Thus, all implicitly typed variables must be
initialized. Using the same mechanism, it is also possible to create an implicitly typed array.
As a general rule, implicitly typed arrays are for use in certain types of queries involving
LINQ, which is described in Chapter 19. In most other cases, you will use the “normal”
array declaration approach. Implicitly typed arrays are introduced here for completeness.
An implicitly typed array is declared using the keyword
var
, but you
do not
follow
Do'stlaringiz bilan baham: |