Questions tagged [explicit-implementation]

28 questions
2
votes
3 answers

Explicit Conversion to IDisposable

I am using some XmlReader and XmlWriter object to do some needed work on strings inside some try...catch blocks. I know that using the notation using (XmlReader NewReader = XmlReader.Create(...)) is the prefered syntax, but I don't really like that…
User
  • 3,244
  • 8
  • 27
  • 48
2
votes
1 answer

Explicit Override Using Automatic Property

I'm trying to use a C++/CLI auto-implemented property to explicitly override an interface. In particular, I have written (in C++/CLI) interface IInterface { property Object ^MyProperty { Object ^get(void); void…
2
votes
3 answers

C++ - allow access through the base class (interface), forbid access through the derived class (concrete implementation)?

Let's say I have pure abstract class IHandler and my class that derives from it: class IHandler { public: virtual int process_input(char input) = 0; }; class MyEngine : protected IHandler { public: virtual int process_input(char input) { /*…
2
votes
2 answers

Overriding / hiding an explicity implemented interface method

I'm having trouble overriding a method that explicitly implements an interface. I have two classes. A base one called OurViewModel, and an inherited one called MyViewModel. They share a method called Validate, and until recently I was able to…
larryq
  • 15,713
  • 38
  • 121
  • 190
2
votes
1 answer

Implementing Interfaces Explictly in F#

Ok, C# has Explictit Interface Implementation I'l like to do similar in F#. I have some Interfaces (and classes) type IState = interface abstract member Update : IAction-> IState ... end type IEnviroment = interface abstract member…
1
vote
2 answers

C++ - Explicit & Implicit Namespace Implementation Differences

I have a question about namespaces if someone can enlighten me :D I don't know if the title is right, I hope so xD Code in the ".cpp" file is called the Implementation of the Namespace and the code in ".h" file is called the Declaration of the…
Z3R0
  • 1,011
  • 10
  • 19
1
vote
1 answer

access IEnumerable.GetEnumerator() from IEnumerable.GetEnumerator()

please find the code there is error that getenuemrator() method is not defined in the class private sealed class SelfAndBaseClasses : IEnumerable, IEnumerator, IEnumerable, IEnumerator, IDisposable { private int state; private Type…
1
vote
2 answers

Explicit interface implementaion with second implementation

I was tracking down a bug and I found this in the Avalon Dock 2.0 source code: public abstract class LayoutContent : LayoutElement, /* ... */, ILayoutPreviousContainer { // ... [XmlIgnore] string…
clcto
  • 9,530
  • 20
  • 42
1
vote
4 answers

Declaring Explicit interfaces and the does not contain a definition error C#

I am having an issue with an explicit interface that I created and am getting the exception, 'x' does not contain a definition for 'y' and no extension method 'y' accepting a first argument of type 'x' could be found I have a series of classes. …
SoftwareSavant
  • 9,467
  • 27
  • 121
  • 195
1
vote
1 answer

Binding to an explicitly implemented generic interface in Silverlight

I understand it's possible to bind to an explictily implemented property using something like this: "{Binding Path=(local:ISomeInterface.SomeProperty)}" but what if the interface is generic? "{Binding…
0
votes
2 answers

How to unit test explicit interface implemented methods?

I have the following method in a service but I'm failing to call it in my unit test. The method uses the async/ await code but also (and which I think is causing me the problem) has the name of the method with a dot notation which I'm not sure what…
Jamie
  • 321
  • 1
  • 6
  • 18
0
votes
1 answer

Exclude explicit interface method with PostSharp attribute multicast

Let's say I have an interface: namespace MyCompany.Security { public interface IMySecurable { string GetContext(); } } Which is implemented by a number of classes, e.g. namespace MyCompany.Repositories { using…
0
votes
1 answer

C# Explicit implementation of interface breaks my INotifyPropertyChanged

This might be little bit stupid question but I could not find any work-around or think of any solutions to the following problem... public class Example: IExample, INotifyPropertyChanged { public Example() { } /// Does not works…
1
2