vb.net - Why cant I set a property of a pointf in a list? -
test class:
public class durp public somelist new list(of pointf) public sub stuff() somelist.add(new pointf) somelist(0).x = 5 end sub end class it tells me on line somelist(0).x = 5 "expression value , thefore cannot target of assignment"
wat?
if want use list(), create own version of pointf class instead of struct.
otherwise, create local variable, modify it, put in:
public sub stuff() somelist.add(new pointf) dim ptf pointf = somelist(0) ptf.x = 5 somelist(0) = ptf end sub alternatively, build list convert array. can use directly planned:
public class durp public somearray() pointf public sub stuff() dim somelist new list(of pointf) somelist.add(new pointf) ' ... add bunch more points somehow ... somearray = somelist.toarray end sub public sub stuff2() somearray(0).x = 5 end sub end class
Comments
Post a Comment