Object reference not set to an instance of an object w/array
Possible Duplicate:
Adding C# labels to a form at Runtime
我不知道是什么导致了这个错误
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
问题在这里 P / < >
1 |
你需要instantiate在
做: P / < >
1 2 3 4 5 6 7 8 9 10 11 |
看来,线的类,(参考型)如果你创建一个阵列的参考类型的所有元素的阵列中,然后把"value of
例如,从msdn单一dimension arrays P / < >
1 |
The result of this statement depends on whether SomeType is a value
type or a reference type. If it is a value type, the statement results
in creating an array of 10 instances of the type SomeType. If SomeType
is a reference type, the statement creates an array of 10 elements,
each of which is initialized to a null reference.