Skip to content

Getting declared base interfaces only #2118

Answered by dgrunwald
daningalla asked this question in General
Discussion options

You must be logged in to vote

The C# compiler already flattens the hierarchy for interfaces; there is no difference in IL between
class MyDictionary : IDictionary<string, object> {}
and
class MyDictionary : IDictionary<string, object>, IEnumerable<KeyValuePair<K,V>> {}

The IL is always:

.class private auto ansi beforefieldinit ParallelForEachTest.MyDictionary
	extends [System.Runtime]System.Object
	implements class [System.Runtime]System.Collections.Generic.IDictionary`2<string, object>,
	           class [System.Runtime]System.Collections.Generic.ICollection`1<valuetype [System.Runtime]System.Collections.Generic.KeyValuePair`2<string, object>>,
	           class [System.Runtime]System.Collections.Generic.IEnumerable`…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by daningalla
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants