interface

If you are using an interface-based design approach, how do you name the more behavioural interfaces?

I'm developing a library containing multiple controls (or components). I'm using an interface based approach to type design, but eventually it led me to a question that bothers me for a long time. If you use an interface-based design approach, how do yo name the behaviour interfaces? For example, let's assume you have some getter setter ...

Partially protected interface but without abstract class.

I have following code. And I need to hide one function of the interface. interface IOne { int FunctionOne(); } interface ITwo { double FunctionTwo(); } interface IInterfaceToImplement : IOne, ITwo { void AFunctionToImplement(); } public abstract MyBaseClass : TheVeryHeavyBaseClass<T, IInterfaceToImplement>, IInterfaceToIm...

Interface Library Versioning - Breaking Changes

I currently have a C# project which uses plugins and has a fairly common approach to plugin handling: an IPlugin interface is stored in a dll which is linked in a tranditional dynamic way. The host app looks for class libraries exporting classes exposing this interface and loads them via reflection at run time. The dll containing the in...

Stop Visual Studio sorting my imported interface members in C#?

When I design interfaces, I don't tend to order their members in alphabetical order - I come up with an order that is logical and readable for the solution. Whenever I implement an interface I use the "smart tag" for the interface name to get Visual Studio to implement skeleton methods / properties for me. This is a neat feature and it ...

is there such a thing as an MXML interface

Hi, This could potentially be a dumb question so apologies in advance if it is. I'm wondering if theres an equivilant of Interfaces in MXML? Everytime I feel the need to use an interface I always wind up making an actionscript and not an MXML file because I don't know if / how you can. For example I was going to have a component based...

Call QueryInterface before CoCreateInstance?

Is the above possible? Can I do this: IUnknown *punk; punk->QueryInterface(IID_MyInterface, (void**)&m_pMyInterface); I thought that this would tell me if the MyInterface is supported m_pMyInterface... ...

Interface arguments in ASP.NET MVC

I'm in the process of developing an ASP.NET MVC project, and after several weeks of research, I have a pretty good framework in place using StructureMap to register my dependencies at bootstrap time, create my controllers with the correct implementations, a custom model binder for passing data to my controller, etc. After thinking about...

Should you always Code To Interfaces In Java

I understand the principles of Coding to Interfaces - to decouple the implementation from the interface, and to allow implementations of the interface to be swapped in and out. Should I code to interfaces for every class I write or is that overkill? I don't want to double the number of source files in a project unless it's really worth...

C# - Interfaces / Abstract class - ensure event is raised on method

I have an interface defined as IStore, with two methods: public interface IStore<TEntity> { TEntity Get(object identifier); void Put(TEntity entity); } I want an event to be raised on the success of Put (for reference, Put could store a row in a db, or file on the file system etc...) So, a class implementing Istore for type ...

Objective c terminal application

Is there such thing? I need to make an application in Xcode to basically do what the terminal app does. With just an nstextfield as the input, a label for the terminal output, and a send button. All this needs to be done without terminal accually being open. Is this possible? If so, can someone post a website or sample code? ...

Implementing an Interface but changing a member to be private

All members of an Interface are public by default. But there are some properties in my interface that I want to be used as private members of some subclasses that implement my interface. Is this something that can and is done or am I way off basis here. I'm working on using more Interfaces in my architecture these days so I'm not that...

pass parameter to repository while maitaining separation of concerns

Hi all. I'm new to mvc and this whole way of programming is pretty unfamiliar for me, so be gentle ... I have in my article repository: public IQueryable<Article> GetArticles(int? category, int? position) { return from a in dc.Articles where a.LanguageIndex == lang && a.CategoryIndex == category && a.ArticlePosition == p...

Strongly-typed property reference to multiple classes with no common interface (C#)

The System.Windows.Documents namespace includes a number of classes with an Inlines property of type InlineCollection. For example, the Paragraph, Bold and Hyperlink classes all have this property. Each of these classes is decorated with ContentPropertyAttribute ... [ContentPropertyAttribute("Inlines")] public class Paragraph : Block ...

asp.net extending IPrincipal

I would like to extend IPrincipal in asp.net to allow me to get the usertype that I will define. I would like to make it possible to do this in a controller string type = User.UserType then in my extension method i will have a method like public string UserType() { // do some database access return userType } how can I do th...

How to create a GIMP/Delphi MDI like interface using WinForms?

I need to create an application that can have numerous documents open on several (between 2 and 6) monitors. The current version of the application uses a traditional MDI interface which does not work well with multiple monitors. I am thinking of making an interface similar to GIMP/Delphi 7 which has a main program toolbar and all other ...

How to Inherit C++/CLI Interface in C#?

Hello, I have declared an interface in C++/CLI and made it assembly(DLL). Now I want that interface to be implement by C# app. I have added the reference but still my C# assembly does not detecting my C++/CLI interface and says "Could not found: Are you missing some assembly refernce......" How to solve this issue? Regards Usman ...

Simulate interface in java with objective-c

Hi all, I came from a java background, and I was trying to use protocol like a java interface. In java you can have an object implement an interface and pass it to a method like this: public interface MyInterface { void myMethod(); } public class MyObject implements MyInterface { void myMethod() {// operations} } public class My...

abstract class does not implement interface

I have an interface so class writers are forced to implement certain methods. I also want to allow some default implemented methods so i create a abstract class. The problem all classes inherit from the base class so i have some helper functions in there. I tried to write :IClass in with the abstract base but i got an error that the bas...

Generic interface VS generic method?

I'm writing a generic type to handle the underlying Active Directory objects such as groups, organisational units and users. I'm also using "manual" dependency injection within my generic interface. I would like to know if, in my situation, which is more appropriate: generic interface or generic method? Here's a simplified code sample ...

Questions with different types of answer in NHibernate

I'm trying to find a tidy solution to a questionnaire problem. Let us say that I have a Questionnaire class which has a collection of Answers, e.g. public class Questionnaire { public virtual ISet<Answer> Answers {get;set;} } Answers need to be of different types depending on the question, e.g. date of birth, marks out of ten, why...