interface

C#: Property overriding by specifying the interface explicitly

While attempting to override the explicit interface implementation of the ICollection<T>.IsReadOnly property from the Collection<T> class, I came across some documents stating that explicit interface member implementations cannot be overridden because they cannot have modifiers such as virtual or abstract. On MSDN they even go as far as ...

Java: Put objects of different types into a ArrayList for a ModelCollection. Interaces?

I want to have my models wrapped up in a ModelCollection which is mostly used for a ListView. The Collection has always the same attributes like title, totalResults (for Pagination) and it shall contain the listItem-Models in the ArrayList "items". However, these models have different types like "ModelCategory" or "ModelChain" and often...

Is it acceptable for an interface definition to contain references to other interfaces?

I was looking at the definition of Spring's PlatformTransactionManager which contains references to TransactionStatus and TransactionDefinition, two other interfaces. Is this acceptable in general, an interface's definition containing references to other interfaces? When is it useful? ...

Using specific patterns to implement interfaces

I have been very intriuged by design patterns lately, and specifically following correct design patterns in my classes that implement one or several interfaces. Let's take an example. When a class implement IDisposable you should follow a specific pattern to make sure that your resources are properly cleaned up, by creating a private Di...

Convert several Java methods to run as non-blocking threads?

Is it possible to convert a number of methods (defined in an interface and implemented in a class) to run as non-blocking threads? Certainly, i can wrap each single method in the run() method of a thread class. But perhaps there exists a more sophisticated way to warp several different methods in one step, i.e. by a single thread class...

Java: Interface with squares (to drag), lines (to link the squares) and animation (square follows the line)

I'm starting to create a Industrial Simulation (IS) interface, using Java. The problem I'm pointing here is the interface. A IS interface will have some big squares (geometrical figure) (unfilled, instead of it they will have their "names" inside it), one or more lines linking the squares, and while time will be going, some "mini-square...

JavaFx: How to develop a visual rich menu interface?

I'm trying to develop a desktop program, unifying java and javafx. For now, I want to know recommendations about how to create a rich menu interface for my program, something like the menu of Office 2007 or Modellus. So, what you recommend to start developing that? ...

ActionScript Interfaces with custom namespaces

Hello! Is there any way to get interface to play along with custom namespace? Example follows. IHeaderRenderer.as: public interface IHeaderRenderer{ function set header(value:IHeader):void; function get header():IHeader; } HeaderRenderer.as import fi.test.internalNamespace; public class HeaderRenderer implements IHeaderRenderer{ ...

Qt interfaces or abstract classes and qobject_cast()

I have a fairly complex set of C++ classes that are re-written from Java. So each class has a single inherited class, and then it also implements one or more abstract classes (or interfaces). Is it possible to use qobject_cast() to convert from a class to one of the interfaces? If I derive all interfaces from QObject, I get an error due...

Unexpected c# interface implementation compiler error

I just came across this weird behavior today: interface IFooBar { void Foo(); void Bar(); } class FooBar : IFooBar { void IFooBar.Foo() { } void IFooBar.Bar() { this.Foo(); } } The line this.Foo(); raises the compiler error 'MyProject.FooBar' does not contain a definition for 'Foo' and ...

Interface instances

Hi, I am new to C#.net and was surprised to know that instances of an Interface can be created like Iinterface myDimensions = (Iinterface) myBox; How is memory allocated for this type of statement? Is the memory allocated on heap? Can any one give any situation where this types of instantiations are used. A class that implement...

Unit Testing abstract classes and or interfaces

I'm trying to start using Unit Testing on my current project in Visual Studio 2010. My class structure, however, contains a number of interface and abstract class inheritance relationships. If two classes are derived from the same abstract class, or interface I'd like to be able to share the testing code between them. I'm not sure how t...

Optional Interface in Class Libraries

I have an interface called IProjectUser that defines a read function and a write function for reading and writing to project files. I also have a class called Project that holds a generic list of IProjectUser objects to manage project files. Both of these are in the class library Project.dll. I also have a class library called A.dll tha...

What's the difference between Interface Map and Mediation Module?

What is the difference between Interface Map and Mediation Module in terms of IBM WID? ...

Comparator as static field - interface or implementation?

I have a class that already has a 'natural' order, and wish to define a different Comparator that can be used similar to String.CASE_INSENSITIVE_ORDER - i.e., define it as an instantiated static field to be referred to when needed. With an interface Foo which is the actual comparison type (it will be Comparator<Foo>), I'm in favor of pu...

How to make custom buttons in vb.net

Do you know of any tutorial that could help me make a custom button in vb.net. Because visual studio 2008 doesn't allow you to create buttons in circle or triangular shapes. I've tried searching and found this one but, I cannot make use of it because there are lots of errors. http://www.codeproject.com/KB/buttons/CButton.aspx ...

Pulling Up Interface Implementation into base class

I'm using a library which requires my views to implement an interface, which is only a dependency property and get\set accessor for it. The only difference is the OwnerType in the DP's Register method. AFAIK, duplicate code is bad, and I've forgotten to change OwnerType after pasting several times now :) So I figure I should try and move...

C# optional arguments in abstract method

Given: interface IFoo { void Print(string text = "abc"); } class Bar : IFoo { public void Print(string text = "def") { Console.WriteLine(text); } } class Program { static void Main(string[] args) { Bar b = new Bar(); b.Print(); IFoo f = b as IFoo; f.Print(); } } Th...

Registering Callback / calling a function when network interface comes up

I want to meassure the time it takes for an interface on a linux system to a) become up and b) become IP capable. This would invoke as a first step to get the linux kernel to tell in some way to call a python function when an 'interface up request' has been sent. Some application (e.g. d-bus) requests: 'iface up' => timer_1.start() ...

How to get selected file in Package Explorer from Eclipse

Hello, I have an Action that implements IObjectActionDelegate. In this action I want to preform some operations over the file that is selected in Package Explorer when I selected my Action. I only have a run(IAction action) method and the ObjectAction filters the files so that the action only appears for the files I want. I'm looking f...