Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have seen lots of samples for resultbuffer objects. And I am not quite undestand where I have to dispose and where not to. I know It doens't hurt to dispose it anyways. But I am a woman and don't like to see extra unnessary lines in my application.Everything should be perfect. So someone explain it for me. Let's say below Funciton . Do I need a dispose ? Thanks . Regards .
Function test(ByVal Myobjid As ObjectId) As Boolean
Dim MyDwg As Document = Application.DocumentManager.MdiActiveDocument
Using Tr As Transaction = MyDwg.TransactionManager.StartTransaction
Dim mydbObj As DBObject = Tr.GetObject(Myobjid, OpenMode.ForRead)
If TypeOf mydbObj Is BlockReference Then
Dim BR As BlockReference = TryCast(mydbObj, BlockReference)
If BR.IsDynamicBlock Then
Dim myrb As ResultBuffer = mydbObj.GetXDataForApplication("BlahBlah")
If myrb.AsArray(1).Value.ToString.StartsWith("TEST") Then
Tr.Commit()
Return True
End If
End If
End If
Tr.Commit()
End Using
Return False
End Function
Solved! Go to Solution.