Namespace System


Class _SimpleDelegate
Public
	hasThisPtr As Boolean
	object As Object
	methodPtr As VoidPtr

	Sub _SimpleDelegate( object As Object, methodPtr As VoidPtr )
		This.hasThisPtr = True
		This.object = object
		This.methodPtr = methodPtr
	End Sub
	Sub _SimpleDelegate( methodPtr As VoidPtr )
		This.hasThisPtr = False
		This.object = Nothing
		This.methodPtr = methodPtr
	End Sub
End Class

Class DelegateBase
Protected
	simpleDelegates As System.Collections.Generic.List<_SimpleDelegate>

	Sub _Add( dg As DelegateBase )
		Dim i As Long
		For i=0 To ELM(dg.simpleDelegates.Count)
			simpleDelegates.Add( dg.simpleDelegates[i] )
		Next
	End Sub

Public
	Sub DelegateBase()
		simpleDelegates = New System.Collections.Generic.List<_SimpleDelegate>()
	End Sub

/*
	Sub Operator + ( sd As System._SimpleDelegate )
		Add( sd )
	End Sub*/
Public
End Class


End Namespace


Function _System_CreateSimpleDynamicDelegate( object As Object, methodPtr As VoidPtr ) As System._SimpleDelegate
	Return New System._SimpleDelegate( object, methodPtr )
End Function
Function _System_CreateSimpleStaticDelegate( methodPtr As VoidPtr ) As System._SimpleDelegate
	Return New System._SimpleDelegate( methodPtr )
End Function
