interface

is an abstract class a type of interface?

In my /interfaces folder I put all my interfaces. Is an abstract class a type of interface? ...

How to find all classes of a particular interface within an assembly in .net

I have a scenario whereby I want n amount of classes to look at the same data and decide if any work needs to be done. Work is done by a team, and multiple teams can work on the data at the same time. I was thinking of creating a class for every team that would implement the CreateWork interface. All CreateWork classes must have their sa...

Abstract enum a annotation attribute type

Hi, I have an interface which multiple enums are implementing, i.e public interface MinorCodes { public abstract int code(); public abstract String description(); } public enum IdentityMinorCodes implements MinorCodes { IDENTITY_UPLOAD_PICTURE_CODE(1, "Error while trying to upload a picture."), } Now I want to have a cus...

C#: interface inheritance getters/setters

I have a set of interfaces which are used in close conjunction with particular mutable object. Many users of the object only need the ability to read values from the object, and then only a few properties. To avoid namespace pollution (easier intellisense) and to get across the usage intent, I'd like to have a small base interface whic...

.NET 2.0 - Creating an interface to allow for editing/adding to be handled by the object itself?

Hi all, I have this code structure: public abstract class ContentEntryBase { public string UniqueIdentifier; public string Title; public abstract ContentType contentType { get;} } public class TextArticle : ContentEntryBase { // Holds plain / HTML text as content public override ContentType contentType { ...

Cast Interface in generic method

Hello All I am new user of interface. My problem is i have create a Generic class which have two parameter one is object type another is interface type. Now within class i can cast object using Reflection but i am not getting the way to cast interface. ...

.NET Framework built-in interfaces, recommendations when building a custom data structure?

I'm implementing an AVL binary tree data structure in C# .NET 2.0 (possibly moving to 3.5). I've got it to the point where it is passing my initial unit tests without needing to implement any framework level interfaces. But now, just looking through the FCL I see a whole bunch of interfaces, both non-generic and generic that I could...

C#: Generic interfaces and understanding "type parameter declaration must be an identifier not a type"

I'm trying to understand the generic interface as described in this My example has an interface: public interface ITest<T> where T: class { T GetByID(int id); } I have a class that implements the interface, using LINQ to enties in project Data, which contains the class myClass: public class Test<myClass> : ITest<myClass...

C# - Is it possible to extend an existing built-in class with a new Interface

Hi, I am just learning C# and I have a problem now. :-) In C++ I loved to use "const reference" as a parameter to avoid that the called method changes my passed object. I read somewhere that I can do sth. similar in C# by using Interfaces. In the interface I would just put some "getters" to allow the method a readonly access to my obje...

Serializable class inheriting from an Interface with a property of its own type

I have an interface, with a definintion for a property that is the same type as the interface. public interface IMyInterface { IMyInterface parent { get; set; } } Now if I declare a class and inherit from the interface, I need to create the property called parent. I want my class to be serializable to us...

when doing a extract to interface, why doesn't it modify the interface previously created?

I created an interface in a file, then a class that implements the interface in another file. If i add a property to the implementation class, is it possible to pass that method signature down to the interface automatically using resharper? I tried, and it seemed to just create another interface in the same file? ...

How to use an Interface as Map’s Key

I am looking for help on the subject how to use an Interface as Maps Key. I tried to implement a solution, and get no compiletime errors but runtime errors when running my integration tests. Is it not possible to use an Interface as a Key, or is it my tests there is something wrong with? My code looks something like this private Map<AI...

Why? Redeclare things to implement interfaces?! in VB.NET

Hello, experts. I work in VB.NET v2 I have an interface IMyInterface and this interface implements a method MyMethod. I have an object MyObjectBase. This object contains a(the same) method MyMethod. 1) If now I do MyObject Inherits MyObjectBase Implements IMyInterface need I to redefine? (shadow, override) MyMethod in the MyObject cl...

Forcing F# type inference on generics and interfaces to stay loose

We're gettin' hairy here. I've tested a bunch of tree-synchronizing code on concrete representations of data, and now I need to abstract it so that it can run with any source and target that support the right methods. [In practice, this will be sources like Documentum, SQL hierarchies, and filesystems; with destinations like Solr and a c...

Anyone has an alternative to using static methods in a C# interface?

I want to implement a collection, whose items need to be tested for emptiness. In case of a reference type, one would test for being null. For value types, one has to implement empty testing, and probably choose a specific value that represents emptyness. My generic collection of T should be usable for both value and reference type valu...

How do you name your "reference" implementations of an interface?

Hi StackOverflow! My question is rather simple and the title states it perfectly: How do you name your "reference" or "basic" implementations of an interface? I saw some naming conventions: FooBarImpl DefaultFooBar BasicFooBar What do you use? What are the pros and cons? And where do you put those "reference" implementations? Curren...

Documenting Interfaces and their implementation

Hi, I'm decorating my C# code with comments so I can produce HTML help files. I often declare and document interfaces. But classes implementing those interfaces can throw specific exceptions depending on the implementation. Sometimes, the client is only aware of the interfaces he's using. Should I document my interfaces by adding the ...

Does a reference work with human behavior/perception patterns exist?

In all current and future projects I pledged to concentrate all the ground work around interaction design. I'm aware of Alan Cooper's work, and it's excellent, but what I'm looking for is a reference work with observed human behavior when confronted with certain visual elements and usage scenarios. Some kind of "user psychology for dev...

interface vs abstract class

In php :: Please explain when i should use interface and when i should use abstract class? And how i can change my abstract class in to an interface? ...

Go: Cannot use (*struct) as (*interface) in field value

I have the following code: // eventloop.go type Object interface { ActivateSlot(name string, parameters vector.Vector); } // main.go import loop "./eventloop" // ... const slotname = "printer" type printer struct { slot loop.Slot; } func (p *printer) Init() { p.slot = loop.Slot{slotname, p}; // offending line } func ...