class - Can I add an object to a struct in VB.net? -
i have data struct piece of lumber. i've built class handle dimensions (architectural, metric, etc... ) i'd make data type of length member of struct. vb says can't use 'new' in definition unless make member 'shared'. if make member 'shared' can't see data when try access member in code.
public structure pieceinfo dim projectnumber string dim projectname string dim buildingtype string dim buildingnumber string dim blevel string dim batch string dim trussname string dim span single dim piecename string dim lumbertype string shared piecelength new clsdimension shared stocklength new clsdimension dim leftspliceplate string dim rightspliceplate string end structure how can use "clsdimension" object data type "length" members of struct?
as comments indicate: should change struct class because want reference it. , due structs being value types , classes being reference types, want:
public class pieceinfo dim projectnumber string dim projectname string dim buildingtype string dim buildingnumber string dim blevel string dim batch string dim trussname string dim span single dim piecename string dim lumbertype string shared piecelength new clsdimension shared stocklength new clsdimension dim leftspliceplate string dim rightspliceplate string end class
Comments
Post a Comment