Using SortedDictionary for .net (imported from C# .dll)
<p>I'm currently working on a python (for .NET) project that interacts with a C# .dll. However, something is wrong with the SortedDictionary I'm importing.</p>

<p>This is what I'm doing:</p>

<pre><code>import clr
from System.Collections.Generic import SortedDictionary
sorted_dict = SortedDictionary&lt;int, bool&gt;(1, True)
</code></pre>

<p>I get the following error when calling Count on sorted_dict:</p>

<pre><code>AttributeError: 'tuple' object has no attribute 'Count'
</code></pre>

<p>sorted_dict doesn't allow me to call any of the public member functions I see in the interface (Add, Clear, ContainsKey, etc.). Am I doing this correctly?</p>

<p>"In that case it's definitely a syntax issue. You're using C# syntax which the Python interpreter no comprende. I think you want something like SortedDictionary[int, bool] based on some coding examples I just found" @martineau</p>

python .net