interface-implementation

C# inherited protected method implementing interface

I have this class/interface definitions in C# public class FooBase { ... protected bool Bar() { ... } ... } public interface IBar { bool Bar(); } Now I want to create a class Foo1 derived from FooBase implementing IBar: public class Foo1 : FooBase, IBar { } Is there some class declaration magic that the compiler ta...

invoking method declaration without reflection

I have a base class (order) with a set of sub classes (productorder, specialorder, partsorder etc). Only Some of these sub classes implement a particular interface (ITrackingCustomer) which has a single method declaration (object getcustdetails()). As part of my solution all of my orders are processed in a central place, i.e. any cru...

How do I pass an ArrayList to method that takes a collection as an input

I want to pass some ArrayList<Integer> X into method a(Collection<Integer> someCol) that takes Collection<Integer> as an input. How can I do this? I thought an ArrayList was a Collection and thus I should be able to "just do it" but it seems that Collection is an interface and ArrayList implements this interface. Is there something I ca...

Error: List<int> does not have the matching of 'System.Collections.Generic.IEnumerable<int>

How to implement interface members "f" with the list? public interface I { IEnumerable<int> f { get; set; } } public class C:I { public List<int> f { get; set; } } Error 1 'ClassLibrary1.C' does not implement interface member 'ClassLibrary1.I.f'. 'ClassLibrary1.C.f' cannot implement 'ClassLibrary1.I.f' because it does not hav...

How to create a custom observable collection using ConcurrentDictionary, INotifyCollectionChanged, INotifyPropertyChanged

Hi All I am trying to create an ObservableConcurrentDictionary. This object will be used in a multithreaded application, and it's data is used to populate a control via the controls ItemsSource property. This is the implementation i have come up with: public sealed class ObservableConcurrentDictionary<TKey, TValue> : ConcurrentDiction...