D is a dictionary whose entry values are of Type T
What I’m attempting to do is have a delegate like “Serializer” below that I can invoke on an instance of T, such as “Entry.Value” below.
Please see the “return Entry…” line below for my wishful thinking.
Is this possible?
If so, is it a bad idea?
Public Delegate Function Serializer(Of T)() As Byte()
Function SerializeDictionary_String_Object(Of T)(ByRef D As Dictionary(Of String, T), ByVal ObjSerializer As Serializer(Of T)) As Byte()
for each Entry in D
return Entry.Value.ObjSerializer()
exit for
next
End Function
In your Serializer delegate, you’re not using T anywhere. You should do something like this:
Or better yet, just use the built in Func delegate.
Then call it by doing:
I’m extremely rusty at VB so my apologies if I missed an underscore or something. 🙂