On 9/23/06, David Anton <[EMAIL PROTECTED]> wrote:
> Any idea what the "Array[int][int]" means?
> Iron Python is ok with it, but I can't figure
> out what it is (or how to initialize it).

Looks like second [int] just overrides previous [int]:

  >>> from System import *
  >>> a = Activator.CreateInstance(Array[int], 10)
  >>> a.GetType()
  <System.RuntimeType object at 0x000000000000002B [System.Int32[]]>
  >>> a = Activator.CreateInstance(Array[int][int], 10)
  >>> a.GetType()
  <System.RuntimeType object at 0x000000000000002B [System.Int32[]]>
  >>> a = Activator.CreateInstance(Array[int][int], 10, 10)
  Traceback (most recent call last):
    File , line 0, in <stdin>##20
    File , line 0, in CreateInstance##21
    File mscorlib, line unknown, in CreateInstance
  AttributeError: Constructor on type 'System.Int32[]' not found.
  >>> a = Activator.CreateInstance(Array[int][Byte], 10)
  >>> a.GetType()
  <System.RuntimeType object at 0x000000000000002C [System.Byte[]]>

So it can be initialized the same way as with only one [int]:

  >>> a = Array[int][Byte]((1, 2, 3))
  >>> a.GetType()
  <System.RuntimeType object at 0x000000000000002C [System.Byte[]]>
_______________________________________________
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to