in

vbCity Blogs

New (temp) place for vbCity Blogs

Mike McIntyre's .NET Journal

Browse by Tags

All Tags » array literal (RSS)
  • Visual Basic 2010 - Array Literals

    Visual Basic 2010 array litererals provide a shortcut mechanism for declaring and filling arrays for types that can be inferred by the compiler. Here a three examples: ' Examples Dim a = {1, 2, 3} 'infers Integer() Dim b = {1, 2, 3.5} 'infers Double() Dim c = {"1", "2", "3"} 'infers String() Becareful not to mix in types the compiler can not infer: ' WARNING: Make sure you used types that can be inferred. ' The next example will generation a warning if OPTION STRICT ON ' or infer a type of Object if OPTION STRICT OFF Dim d = {1, "123"} 'infers Object() (warning with Option Strict On) Create multidimensional arrays with array literals: ' Create multidimensional arrays by nesting array array literals: 'Nested array literals can be used to produce multidimensional arrays: Dim f = {{1, 2, 3}, {4, 5, 6}} 'infers Integer(,) Dim g = {({1, 2, 3}), ({4, 5, 6})} 'infers Integer()() (jagged array) ...
  • Visual Studio 2010 - Visual Basic Array Literals

    Here's another way Visual Basic 2010 makes it easier to program: Array Literals The Visual Basic compiler is smart enough to recognize when an array literal is composed of elements of the same type e.g. it 'infers' an array of integer in the...
Copyright 1998-2009 vbCity.com LLC
Powered by Community Server (Non-Commercial Edition), by Telligent Systems