vb.net - Observe List(Of) additions -
i have list (of customclass). somewhere within code, items added list although should not. code huge, can't debug occurs. therefore thinking of creating extension can break in when insert / add occurs when don't expect it.
can tell me if possible, , if yes, how?
i hope can somehow detect caller (the function) additions occur.
thank you.
i think have it:
imports system.collections.objectmodel public class clscelllistextender public class list(of t) inherits collection(of t) private _iid integer = 0 protected overrides sub insertitem(index integer, item t) 'your checks here if typeof (item) clscell _iid += 1 dim ncell clscell = trycast(item, clscell) ncell.tempid = _iid end if mybase.insertitem(index, item) end sub end class end class i declare list clscelllistextender.list(of clscell).
Comments
Post a Comment