Questions tagged [explicit-interface]

C# Explicit Interface Implementation when implementing two interfaces, both with the same method and different implementations

88 questions
0
votes
0 answers

Is it possible to have explicit-only conformance to a protocol?

First things first. Since I know it's inevitable, there's a similar question here about this same topic. While the topic is the same, the reasoning/usage of it is different in its intent. Thus solving that question is not the same as…
Mark A. Donohoe
  • 28,442
  • 25
  • 137
  • 286
0
votes
1 answer

Is it a bad idea to have hide methods and have different method implementations behind different interfaces?

I have a interface which currently extends IDictionary<> (and an implementation which Extends Dictionary<>), but I want to have an implementation of this interface which does not allow entries to be added or removed (I want to allow existing entries…
Sam Holder
  • 32,535
  • 13
  • 101
  • 181
0
votes
0 answers

Basic python - Multiple inheritance name clash

Given python classes: class ITextWriter: def write( ... class IImageWriter: def write( ... class MyFileHandler(ITextWriter, IImageWriter): ??? Is it possible to specify implementations for the ITextWriter and IImageWriter interfaces…
c z
  • 7,726
  • 3
  • 46
  • 59
0
votes
1 answer

Display explicit interface members in a propertygrid?

Suppose we have this code: interface myInterface { long Test { set; get; } } class myInterfaceImp : myInterface { long myInterface.Test { get; set; } } and in our form, we set the propertygrid: propertyGrid1.SelectedObject = new…
BHP
  • 443
  • 4
  • 13
0
votes
2 answers

Why does the .NET BCL class ClientBase EXPLICITLY implement IDispose

I understand that the ClientBase class explicitly implements the IDisposable interface, however I don't understand why it was done explicitly. ClientBase doesn't implement IDisposable member If MyClient derives from ClientBase I cannot…
user978139
  • 579
  • 4
  • 16
0
votes
2 answers

How to access complex types Argument in C#

I am trying to use one WCF service, since we don't have the service URL we got XSD and WSDL. At this point of time trying for POC stuff for that. Using svcutil tool genarated class file. I am not very much familiar with WCF stuff, so first trying to…
Chiranjeevi
  • 161
  • 1
  • 4
  • 22
0
votes
1 answer

Stubbing out methods that explicitly implement an interface using Rhino Mocks

How can I stub out methods that explicitly implement an interface using Rhino Mocks? As I understand it, Rhino Mocks requires stubbed out methods to be virtual, and explicitly implemented interface members are not virtual.
Ben Aston
  • 53,718
  • 65
  • 205
  • 331
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
votes
1 answer

Explicit standard .NET interface implementation

I need to explicitly implement standard c# interfaces such as (IComparable, IComparer, IEquatable, IEnumerable, IEnumerator). Am I doing it right? class Lemon : IComparable { public String name { get; set; } public int id {…
uvytautas
  • 518
  • 8
  • 18
-1
votes
2 answers

Using the new-keyword to join a method of two interfaces

I have two Interfaces A,B (residing in different components). Both declare a method with the same signature ( MyMethod ). The two interfaces are inherited by a third Interface (C). The method which is declared in the first two interfaces (A,B) is…
HCL
  • 36,053
  • 27
  • 163
  • 213
-2
votes
2 answers

Trying to add class objects to a list, but getting "no overload for method Add takes 3 arguments"

I'm trying to solve this problem: I am working on a homework exercise that is printing info about citizens, and I am stuck on the part where I have to add the citizens to a list of the class Citizen. I am getting an error when adding the created…
-4
votes
2 answers

Does type casting in C# occur here?

I have a basic question regarding type casting. class A { } class B : A { } B b = new B(); A a = (A)b; In the above code whether type casting will occur? interface IA { void process(); } class B : IA { #region…
LokiDil
  • 197
  • 1
  • 3
  • 13
1 2 3 4 5
6