interface

interface property copy in c#

I've been working with C# for many years now, but just come across this issue that's stumping me, and I really don't even know how to ask the question, so, to the example! public interface IAddress { string Address1 { get; set; } string Address2 { get; set; } string City { get; set; } ... } public class Home : IAddress { // I...

Attribute to add to an Interface for the default concrete class?

This probably isn't possible, but it's annoying enough to try... For convenience sake I'd like to be able to select "Go to definition" on a property or method on a variable defined as an interface and have Visual Studio go to the concrete implementation instead of the interface. Is there an attribute or something that I can use to instr...

Plugins to application ( Can i control the namespace/code inside the plugins )

Im currently adding a interface to my application so other people can extend it with plugins. My application is used by MMO gamers and i will not have any control over the plugins ( In that anyone will be allowed to make them ) and i was hoping i could have some degree of control over the code in the plugins. What im afraid of is someon...

Tool to generate interface implementation by delegation ?

I often need to implement an interface by delegating the implementation to a member of my class. This task is quite tedious because, even though Visual Studio generates stubs for the interface methods, I still have to write the code to delegate the implementation. It doesn't require much thinking, so it could probably be automated by a c...

Factories, or Dependency Injection for object instantiation in WCF, when coding against an interface?

Hi I am writing a client/server application, where the client is a Windows Forms app, and the server is a WCF service hosted in a Windows Service. Note that I control both sides of the application. I am trying to implement the practice of coding against an interface: i.e. I have a Shared assembly which is referenced by the client appli...

JQuery replacing image problem

Hi, I want to extend some JQuery code to replace an image once I click on it. I have this: var minimiseContent = function(e) { var targetContent = $('div.itemContent', this.parentNode.parentNode); if (targetContent.css('display') == 'none') { targetContent.slideDown(300); var minIcon = $('minimise', this.parentN...

Inline Interface implementation in Actionscript

Is something like this possible in Actionscript? Java: URLFetcherFactory.setCreator( new IURLFetcherCreator() { public IURLFetcher create() { return new URLFetcher(); } } ); Actionscript: ? I've been wondering about this and have been unable to find anything that indicates it's possible. Figured if it was ...

Virtual vs Interface poco, what's faster?

I am maintaining an application which has been designed like this: messy code --abuses--> simplePoco (POCO data capsule) The data capsule is a simple class with lots of getters and setters (properties) It uses a DI framework and consistently use the IoC container to provide instances of the data capsule (lucky me!). The problem is, I...

Some issues with sending List<T> as IEnumerable<T> to a method.

Possible Duplicate: Upcasting and generic lists Ok, I want to send a List<CardHolder> as an IEnumerable<ICardHolder> where CardHolder : ICardHolder. However, the compiler errors: Error 4 Argument '1': cannot convert from 'System.Collections.Generic.List' to 'System.Collections.Generic.IEnumerable' This seems strange to me...

tagging Interfaces?

Why do we have tagging interface? what is the use?(sorry for the question if its too noob but i just not getting it!) ...

How to make a Java class that implements one interface with two generic types?

I have a generic interface public interface Consumer<E> { public void consume(E e); } I have a class that consumes two types of objects, so I would like to do something like: public class TwoTypesConsumer implements Consumer<Tomato>, Consumer<Apple> { public void consume(Tomato t) { ..... } public void consume(Apple a) { ...

UIButtons don't respond to touch after set frame on autorotate

Hello in my app i have some uiButtons added as subviews to a view like in the picture below. when the user rotates the phone in landscape the views and buttons must change position to this: initially when the view is in portrait mode the buttons respond to touches. If i tilt the phone the buttons move, everything looks ok like in the...

Enforce Object Property to be serializable

I am building a class and in the interface for my class(es) I have a property declared object MyObject { get; set; } What I want to do is force whatever is stored in MyObject to be serializable. Is there a good way to do this? Normally, I'd use where : ISerializable, but for serialization you use an attribute, not inheritance, or at...

C#-Generics -ISerializable,IEnumerable,IList -efficient application

I need simple example to use ISerializable,IEnumerable,IList with Generics efficiently. Also wish to know what are all the other Interfaces we can use along with Generics. Update : The task i need to perform is using these interfaces I have to serialize the custom Types Collect them in Generic object Iterate them to find the ma...

Should programming according to the interface hide everything?

OOP is about programming with interface, not the implementation. Objects are "talking" to each other using their interfaces. When interfaces are not well defined one object can know too much about the other and if you need to change implementation of your object you'll need to change your programm in different places. That's really bad, ...

generic function with a "has property X" constraint?

I have a third-party, closed source application that exports a COM interface, which I am using in my C#.NET application through Interop. This COM interface exports many objects that all show up as System.Object until I cast them to the appropriate interface type. I want to assign an property of all of these objects. Thus: foreach (objec...

Convert Interface IDL file to C#

I have an interface defined in an IDL file that I would like to use in C#. Is there a way to convert the IDL to something usable in C#? ...

Access UIButton from parent class while using function from another object class on the iPhone

I'm using openAL to play audio files. I'm using a uibutton to play an audio file. I access this play method that loads and plays the audio file from an object called oalPlayback. I have connected this button and method in interface builder by dragging the object into the nib /xib window. I then shift drag the button to the object to a...

How do you implement IDataRecord properly if IndexOutOfRangeException is a reserved exception type?

According to the documentation for IDataRecord, the implementing methods must throw IndexOutOfRangeException if the field index is out of the range of fields. However, if you try to throw an IndexOutOfRangeException directly in code, FXCop complains that it is a reserved exception type. How do you keep to the IDataRecord exception contra...

What is an interface in Java?

Just as a counterpoint to this question: what is an interface in Java? ...