C# to Cobra (was Dictionary Initializers)
Posted: Sat Apr 06, 2013 12:06 pm
I'm not sure if this is a PEBCAK issue or compiler issue, so thought I'd post here.
I've got the following code:
Which is attempting to make use of the constructor identified here: http://msdn.microsoft.com/en-us/library ... 00%29.aspx (which is a valid constructor all the way back to .Net 2.0 so I don't think I have a framework target issue). When I attempt to compile, I get:
Am I calling the constructor incorrectly? A similar call in C# does not cause this issue:
I've got the following code:
- Code: Select all
d = {{ "&": "&" }, { "<": "<" }, { ">": ">" }, { '"': """ }, { "'": "'" }, { "`": "`" }}
_oHTML = Dictionary<of String,String>(d,StringComparer.ordinal)
Which is attempting to make use of the constructor identified here: http://msdn.microsoft.com/en-us/library ... 00%29.aspx (which is a valid constructor all the way back to .Net 2.0 so I don't think I have a framework target issue). When I attempt to compile, I get:
SafeString.cobra(0,0): Error: The best overloaded method match for "System.Collections.Generic.Dictionary<string,string>.Dictionary(int, System.Collections.Generic.IEqualityComparer<string>)" has some invalid arguments (SnakeTracks)
Am I calling the constructor incorrectly? A similar call in C# does not cause this issue:
- Code: Select all
var x = new Dictionary<string, string>(HTML, StringComparer.Ordinal);