Posted By

martinB on 02/06/09


Tagged

array Net dotnet


Versions (?)

Copy data into dotNet array


 / Published in: Maxscript
 

Example that shows how to read and write a dotNet array

  1. -- .NET arrays indexes start at 0!
  2.  
  3. -- Create a .NET array of 10 integers
  4. intArray = dotNetObject "System.Int32[]" 10
  5.  
  6. -- Fill array
  7. for idx = 1 to 10 do
  8. (
  9. intValue = dotNetObject "System.Int32" (random 1 100)
  10. intIndex = dotNetObject "System.Int32" (idx-1)
  11. intArray.SetValue intValue intIndex
  12. )
  13.  
  14. -- Print array data
  15. for idx = 1 to 10 do
  16. (
  17. intIndex = dotNetObject "System.Int32" (idx-1)
  18. print (intArray.GetValue intIndex)
  19. )

Report this snippet  

You need to login to post a comment.