Test2.cs class Test2 { private Test1 test1; private string name; private NotStorable transientClass; public Test2(string name, NotStorable transientClass, Test1 test1) { this.test1 = test1; this.name = name; this.transientClass = transientClass; } public override string ToString() { if (transientClass == null) { return string.Format("{0}/{1}; test1: {2}", name, "null", test1); } else { return string.Format("{0}/{1}; test1: {2}", name, transientClass, test1); } } }
Test2.vb Class Test2 Private test1 As Test1 Private name As String Private transientClass As NotStorable Public Sub New(ByVal name As String, _ ByVal transientClass As NotStorable, ByVal test1 As Test1) Me.test1 = test1 Me.name = name Me.transientClass = transientClass End Sub Public Overloads Overrides Function ToString() As String If transientClass Is Nothing Then Return String.Format("{0}/{1}; test1: {2}", name, _ "Nothing", test1.ToString()) Else Return String.Format("{0}/{1}; test1: {2}", name, _ transientClass.ToString(), test1.ToString()) End If End Function End Class