Integer = 0 To 9
val *= 2
lst.Add(val)
Next
Since val is a ValueType, when we assign it to the list we actually put a copy of val into the list. Thus, the list contains the following memory layout:
[0] = 2
[1] = 4
[2] = 8
[3] = 16
[4] = 32
[5] = 64
[6] = 128
[7] = 256
[8] = 512
[9] = 1024
Now let's assume we do the same, but with OnLines:
Dim ln As New OnLine(A, B)
Dim lst As New List(Of OnLine)
For i As Integer = 0 To 9
ln.Transform(xform)
lst.Add(ln)
Next
When we declare ln on line 1, it is assigned an address in memory, say "24 Bell Ave." Then we modify that one line over and over, and keep on adding the same address to lst. Thus, the memory layout of lst is now:
[0] = "24 Bell Ave."
[1] = "24 Bell Ave."
[2] = "24 Bell Ave."
[3] = "24 Bell Ave."
[4] = "24 Bell Ave."
[5] = "24 Bell Ave."
[6] = "24 Bell Ave."
[7] = "24 Bell Ave."
[8] = "24 Bell Ave."
[9] = "24 Bell Ave."
To do this properly, we need to create a unique line for every element in lst:
Dim lst As New List(Of OnLine)
For i As Integer = 0 To 9
Dim ln As New OnLine(A, B)
ln.Transform(xform)
lst.Add(ln)
Next
Now, ln is constructed not just once, but whenever the loop runs. And every time it is constructed, a new piece of memory is reserved for it and a new address is created. So now the list memory layout is:
[0] = "24 Bell Ave."
[1] = "12 Pike St."
[2] = "377 The Pines"
[3] = "3670 Woodland Park Ave."
[4] = "99 Zoo Ln."
[5] = "13a District Rd."
[6] = "2 Penny Lane"
[7] = "10 Broadway"
[8] = "225 Franklin Ave."
[9] = "420 Paper St."
--
David Rutten
david@mcneel.com
Poprad, Slovakia…
Added by David Rutten at 6:26am on September 9, 2010
etc.
Group 2 - 1, 6, 11, 16, 21 etc.
Group 3 - 2, 7, 12, 17, 22 etc.
Group 4 - 3, 8, 13, 18, 23 etc.
Group 5 - 4, 9, 14, 19, 24 etc. "
except in data, the branches start at 0, so 'group 1' is branch 0
as for the order of your points, that depends on the input prior sorting...
yrs …
s 8, 4, 2, 10, 1, 3, 8, 4, 2, 0. But then for the end result to maintain all numbers above 5 but replace all numbers below with a defined number..Let's say zero. So then the list would read...8, 0, 0, 10, 0, 0, 8, 0, 0.…
dont get you, i am saying sleect numbers in range 1 to 10, starting from 1 with a step of 2.
1 to 10 by 3 = 1 4 7 10
1 to 10 by 5 = 1 6
1 to 10 by 1 = 1 to 10 = 1 2 3 4 5 6 7 8 9 10
Added by Steve Lewis at 3:15pm on November 11, 2013
e! I do not have good ideas today!
The end result of the list would be:
5, 10, 15, 20, 21, (21 + 5), (21 + 10), (21 + 15), (21 + 20), (21 + 21), (42 + 5), (42 + 10), (42 + 15), (42 + 20), (42 + 21), etc …
1+2+3+4+5+6 = 21
1+2+3+4+5+6+7 = 28
1+2+3+4+5+6+7+8 = 36
1+2+3+4+5+6+7+8+9 = 45
Is there a tool, that can do me that job?
How do I get this List {1,3,6,10,15,21,28,36,45}?…
Added by Ahmed Hossam at 2:19pm on September 22, 2013