interface

Can I constrain a template parameter class to implement the interfaces that are supported by other?

The name is a little blurry, so here's the situation: I'm writing code to use some 'trajectories'. The trajectories are an abstract thing, so I describe them with different interfaces. So I have a code as this: namespace Trajectories { public interface IInitial<Atom> { Atom Initial { get; set; } } public interf...

Any one can tell me the disadvantages of the INTERFACES patterns.

Hi everybody I have been reading documents during the last two days about the advantages that you have using INTERFACES PATTERNS (no design patterns), but I can catch the disadvantages especially when the analysis involves the comparison with guidelines. Thank you very much in advance for all your comments. Daniel ...

Are GUIDs necessary to use interfaces in Delphi?

The official documentation says they are optional. I know COM interop requires a unique identifier for each interface but every interface example I see has a GUID whether it's used with COM or not? Is there any benefit to including a GUID if its not going to be used with COM? ...

Get layout frame of NSView (i.e. ibLayoutInset)

I'm working on an Interface Builder-type app for interface design. I would like to be able to align NSView's along their layout frames. Is there a way to access the ibLayoutInset property from my code? ...

Delphi RTTI unable to find interface

I'm trying to fetch an interface using D2010 RTTI. program rtti_sb_1; {$APPTYPE CONSOLE} {$M+} uses SysUtils, Rtti, mynamespace in 'mynamespace.pas'; var ctx: TRttiContext; RType: TRttiType; MyClass: TMyIntfClass; begin ctx := TRttiContext.Create; MyClass := TMyIntfClass.Create; // This prints a list of all kn...

Should I use an interface or factory (and interface) for a cross-platform implementation?

Example A: // pseudo code interface IFoo { void bar(); } class FooPlatformA : IFoo { void bar() { /* ... */ } } class FooPlatformB : IFoo { void bar() { /* ... */ } } class Foo : IFoo { IFoo m_foo; public Foo() { if (detectPlatformA()} { m_foo = new FooPlatformA(); } else { ...

Generic Interface with method pointer

So, first I have my command property interface public interface ICommandProperty<T, U> { Func<T> CreateCommand { get; set; } Func<T, U> ParseResponse { get; set; } } The idea is that I can create a simple parser that takes a string and returns an IPAddress for example. This interface is then used in another interface: public...

Using attributes to fulfill interface requirements

Ok, I'm on the verge of overthinking this. Is there a way to combine interfaces and attributes such that an attributed property in the implementing class fulfills the interface contract? In my app I'd like to show a list of activities, which is an aggregation of events in the system such as a new message, a new task being created/assig...

Interface and base class mix, the right way to implement this

I have some user controls which I want to specify properties and methods for. They inherit from a base class, because they all have properties such as "Foo" and "Bar", and the reason I used a base class is so that I dont have to manually implement all of these properties in each derived class. However, I want to have a method that is o...

How to implement IEditableCollectionView interface

Can anyone please tell me how to implement IEditableCollectionView interface? I am trying to use a custom list for data binding to a data grid in WPF (C#) and need to implement this interface for editing data. Thanks. ...

Make an abstract class or use a processor?

I'm developing a class to compare two directories and run an action when a directory/file in the source directory does not exist in destination directory. Here is a prototype of the class: public abstract class IdenticalDirectories { private DirectoryInfo _sourceDirectory; private DirectoryInfo _destinationDirectory; prot...

Delphi TRttiType.GetMethods return zero TRttiMethod instances

I've recently been able to fetch a TRttiType for an interface using TRttiContext.FindType using Robert Loves "GetType"-workaround ("registering" the interface by an explicit call to ctx.GetType, e.g. RType := ctx.GetType(TypeInfo(IMyPrettyLittleInterface));). One logical next step would be to iterate the methods of said interface. Consi...

How to use interfaces in exception handling

Hi, I'm working on the exception handling layer for my application. I have read few articles on interfaces and generics. I have used inheritance before quite a lot and I'm comfortable with in that area. I have a very brief design that I'm going to implement: public interface IMyExceptionLogger { public void LogException(); // ...

Excel I have a .Net object compiled as a tlb but cant not access any methods apart from Dispose.

Hi This is ongoing issue to something I posted yesterday. I have a .net object that I want to use in Excel. I have an existing VBA script that i need to alter to call this the object from. I have then converted the object to a TLB. I've not really touched on this area before so any help will be appreciated. I have created an interfac...

How to reference a class that implements certain interface?

I have an interface for logging the exceptions, i.e. IExceptionLogger. This interface has 3 implementations: DBExceptionLogger, XMLExceptionLogger, CSVExceptionLogger. I have an application that will make a use of DBExceptionLogger. The application references only IExceptionLogger. How do I create an instance of DBExceptionLogger wit...

Actual use of interface in java

Possible Duplicate: Java Interfaces? What is the use of interface in java? Is interface helps to provide multiple inheritance actually? ...

When to define your ivars as pointers?

Can someone explain to me when it is necessary to define your ivars as pointers? I've seen many code samples that don't use pointers, while others do. ...

Behaviour to simulate an enum implementing an interface

Say I have an enum something like: enum OrderStatus { AwaitingAuthorization, InProduction, AwaitingDespatch } I've also created an extension method on my enum to tidy up the displayed values in the UI, so I have something like: public static string ToDisplayString(this OrderStatus status) { switch (status) { ...

Linqpad seemingly does not recognize implemented interface

I have a c# project GenericBusinessObject and a project WebRole, which uses GenericBusinessObject. WebRole has a BusinessObject Workitem, that implements the Interface method IFastSearchable.IndexDocument that is called from within GenericBusinessObject. Actually the WorkitemBusinesObject is declared in WebRole as GenericBusinessObject. ...

Delphi interface cast using TValue

I've recently experimented extensively with interfaces and D2010 RTTI. I don't know at runtime the actual type of the interface; although I will have access to it's qualified name using a string. Consider the following: program rtti_sb_1; {$APPTYPE CONSOLE} uses SysUtils, Rtti, TypInfo, mynamespace in 'mynamespace.pas'; var ctx: ...