From the course: Grasshopper and Rhino: C# Scripting
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Arrays
- Lists are a great collection type to store, reorder, insert, and retrieve items. Another collection type that we'll come across in the Rhino API is the array. Unlike lists, arrays are a collection of items with fixed length, which is determined when they're initialized. So they're useful when we need to store a specific number of items that will not change. Arrays also provide a minor performance benefit. However, this is negligible in the scripts that we're building. So while we won't be creating them so much, we will be using them within the Rhino API. So let's have a look at the basics of using them. Go ahead and place a new C# component and open it up. To create an array we start with the object type. Let's create an array of integers. We then need to add open and close square brackets. This now defines the type as an array of integers and that's all that it can store. We then need to name it. Let's use my array.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Commenting2m 27s
-
(Locked)
Variables5m 1s
-
(Locked)
Numbers6m 36s
-
(Locked)
Strings5m 37s
-
(Locked)
Collections5m 34s
-
(Locked)
Arrays5m 32s
-
(Locked)
Comparing with operators5m 3s
-
(Locked)
Conditionals3m 30s
-
(Locked)
Logical operators6m 26s
-
(Locked)
Looping with the for loop5m 23s
-
(Locked)
Foreach looping4m 29s
-
(Locked)
Nested loops5m 12s
-
(Locked)
Methods6m 5s
-
(Locked)
Reference vs. value types5m 21s
-
(Locked)
Try and catch4m 14s
-
(Locked)
-
-