views:

86

answers:

3

I am coverting portions of a code project article (http://www.codeproject.com/KB/linq/auto-logging-data-context.aspx) to VB.Net for my own uses but I've run across a piece of C# code written in a way that I've never seen before and which I don't know how to convert:

private static Dictionary<type,> _cachedIL = new Dictionary<type,>();

To me this looks like a dictionary decleration with no type specified for the value. Later on in the same code block the author returns what I believe is a delegate that does something that looks syntactically similar:

return ((Func<t,>)myExec)(myObject);

Any help in understanding whats going on here and how to conver it to VB.Net would be most appreciated.

+2  A: 

The code in question is not valid code, there is no way to convert this. This is either an error on the author's part or the author is focusing on some other aspect and this is pseudo-code.

casperOne
Thanks. I guess that explains my confusion :)
Patricker
+1  A: 

A few lines down:

Delegate myExec = null;
if (!_cachedIL.TryGetValue(typeof(T), out myExec))

from that, it was supposed to be

private static Dictionary<type, Delegate> _cachedIL 
      = new Dictionary<type,Delegate >();

I think it was just some formatting issue.

Henk Holterman
A: 

Maybe the article author did not format the code correctly and as such the codeproject rendering engine mucked up the lines with <> characters in them. It appears like there are other problems besides that though. As best I can tell the code should read:

private static Dictionary<Type, Delegate> _cachedIL = new Dictionary<Type, Delegate>();

and

return ((Func<T, T>)myExec)(myObject); 
Brian Gideon