File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -388,7 +388,7 @@ For interfaces that are strictly single-inheritance (each interface in the inher
388388>
389389> interface ICounter
390390> {
391- > void Count ( int i );
391+ > int Count { get ; set ; }
392392> }
393393>
394394> interface IListCounter : IList , ICounter {}
@@ -397,15 +397,14 @@ For interfaces that are strictly single-inheritance (each interface in the inher
397397> {
398398> void Test (IListCounter x )
399399> {
400- > x .Count (1 ); // Error
401- > x .Count = 1 ; // Error
402- > ((IList )x ).Count = 1 ; // Ok, invokes IList.Count.set
403- > ((ICounter )x ).Count (1 ); // Ok, invokes ICounter.Count
400+ > x .Count = 1 ; // Error
401+ > ((IList )x ).Count = 1 ; // Ok, invokes IList.Count.set
402+ > ((ICounter )x ).Count = 1 ; // Ok, invokes ICounter.Count
404403> }
405404> }
406405> ```
407406>
408- > the first two statements cause compile - time errors because the member lookup ([§12 . 5 ](expressions .md #125 - member - lookup )) of `Count ` in `IListCounter ` is ambiguous . As illustrated by the example , the ambiguity is resolved by casting `x ` to the appropriate base interface type . Such casts have no run -time costs —they merely consist of viewing the instance as a less derived type at compile -time .
407+ > the first statement causes a compile - time error because the member lookup ([§12 . 5 ](expressions .md #125 - member - lookup )) of `Count ` in `IListCounter ` is ambiguous . As illustrated by the example , the ambiguity is resolved by casting `x ` to the appropriate base interface type . Such casts have no run -time costs —they merely consist of viewing the instance as a less derived type at compile -time .
409408>
410409> *end example *
411410<!-- markdownlint -disable MD028 -->
You can’t perform that action at this time.
0 commit comments