I have just learned that using the = operator creates a reference to the original instance of the class rather than creating a copy. What I did to get around this is created a ShallowCopy function:
My question...What is best practice regarding custom classes and creating copies that do not refer to the original instance data?Code:Imports System.ComponentModel <TypeConverter(GetType(ExpandableObjectConverter)), Serializable()> Public Class BoundingBox Public Sub New() LowerLeft = New Vertex UpperRight = New Vertex End Sub Public Property LowerLeft As Vertex Public Property UpperRight As Vertex Public Function ShallowCopy() As BoundingBox Dim tempBB As New BoundingBox With tempBB .LowerLeft = LowerLeft.ShallowCopy .UpperRight = UpperRight.ShallowCopy End With Return tempBB End Function End Class