Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I'd wonder why (Console.WriteLine(c(1)(1))) printed out Zero?
And explain me what is role of c(1) = System.Array.CreateInstance(GetType(System.Int32), 10)?

VB
Imports System
Imports System.Data
Imports System.Collections

public class MainClass
   Shared Sub Main()
        Dim c()() As Integer = {New Integer() {1, 2}, New Integer() {1, 2, 3}}

        c(1) = New Integer() {4, 5}
        Console.WriteLine(c(1)(1))
        c(1) = System.Array.CreateInstance(GetType(System.Int32), 10)
        Console.WriteLine(c(1)(1))
        Dim d() As Integer = {6, 7}
        c(1) = d
        Console.WriteLine(c(1)(1))
   End Sub
End Class
Posted
Updated 26-Apr-15 20:11pm
v5
Comments
upendra shahi 27-Apr-15 2:20am    
Kindly read this article :
http://stackoverflow.com/questions/8680663/casting-system-array-object-to-int-string-or-other-types-objects

1 solution

All the answers you need are gently provided by the documentation: Array.CreateInstance Method (Type, Int32)[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900