Copy data into dotNet array

Submitted by:Pitter Alderson

Date added:07 May, 2012

Category:Maxscript

An example code to Copy data into dotNet array

Tags: dotnet array

Code Snippet:

    -- .NET arrays indexes start at 0!

-- Create a .NET array of 10 integers
intArray = dotNetObject "System.Int32[]" 10

-- Fill array
for idx = 1 to 10 do
(
intValue = dotNetObject "System.Int32" (random 1 100)
intIndex = dotNetObject "System.Int32" (idx-1)
intArray.SetValue intValue intIndex
)

-- Print array data
for idx = 1 to 10 do
(
intIndex = dotNetObject "System.Int32" (idx-1)
print (intArray.GetValue intIndex)
)
 
 

Comments