interface

Interface as property return type when underlying type *could* be different?

Sorry about the title. I do realize it's not very descriptive. :| Here is my problem. I have a Table class that defines various properties found for a database table. Within this object I also have a property called PrimaryKey. PrimaryKey can either be of type PrimaryKey (I know, confusing) or CompositeKey. Evidently, a single column pr...

Fluent Nhibernate: Mapping single entity with interface requirements

Good afternoon. Before I begin my explanation, I have had a look at other similar questions but the subtle differences (mainly in purpose of design) mean that the solutions provided in these answers to not apply to me. I am attempting to create a 'Base data access library' for use with future projects so that I do not have to spend my ...

Running a dynamic void from a assembly loaded into an interface

So, i have an assembly that i loaded into the interface, and it works perfectly: MarshalByRefObject pluginObject = ... ecko.Plugins.Interface.Plugin plug = pluginObject as ecko.Plugins.Interface.Plugin; but, allthough i will have alot of methods in the interface, i will have to execute methods that are dynamic, and determined from inf...

How do you execute a Generic Interface method without knowing the exact type declaration

I have an interface declared as follows public interface ILoadObjects<T> where T : class { List<T> LoadBySearch(); } I then have a class declared as follows public class MyTestClass : ILoadObjects<MyTestClass> { List<MyTestClass> ILoadObjects<MyTestClass>.LoadBySearch() { List<MyTestClass> list = new List<MyTestCl...

What is implicit and explicit implementation of interfaces in dot net?

What is implicit and explicit implementation of interfaces? In which scenario it uses? why its need ? in dot net ...

Force generic interface implementation in C#

Is there anyway to force a constraints for a generic definition to implement a "generic interface" ... that is, I want the class to support passing an interface and a generic class constraining it so that the class implements the interface. For example if I say: MyGenericClass<IMyInterface, MyImplementation>.DoSomething(); That should...

How widespread are Actionscript3 naming conventions?

In 90% of the example projects I see for ActionScript / Flex I notice the following two coding conventions: 1) private member variables with getters/setters start with an underscore as in "_credentials" and 2) interfaces start with the letter "I" as in "ISessionInfo" Coming from the Java world, I find both of these conventions unnec...

C#: Android phone control

Would it be possible to control/interface with an Android phone through USB in a WinForm application? Is there any library for that, without using any original Android tool (ADB, fastboot)? ...

C# + PHP in the same application?

What im trying to do is a little different, im wondering, if its possible to create sorts of an interface, so that if a particular function is called in php (stand alone), than the arguments will be forwarded to a method in C#, and vice versa. ...

What class does the target object take on after casting?

OK, noob question. I'm studying for the SCJP and got 3 questions on object reference casting wrong which all seem to point to the same misunderstanding. Just wanted to confirm what the right insight should be. Right, here are the questions: 1. 1. class CodeWalkFour { 2. public static void main(String[] args){ 3. Car c = ne...

Why are C# interface methods not declared abstract or virtual?

C# methods in interfaces are declared without using the virtual keyword, and overridden in the derived class without using the override keyword. Is there a reason for this? I assume that it is just a language convenience, and obviously the CLR knows how to handle this under the covers (methods are not virtual by default), but are there...

Passing different content that implements the same interface

I have multiple Linq2Sql Classes such as "Article" "NewsItem" "Product". They all have a title, they all have a unique ID and they all have a Summary. So, I created an interface called IContent public interface IContent { int Id { get; set; } String Title { get; set; } String Summary { get; set; } String HyperLink { ge...

help with interfaces and abstract classes

I'm recently getting a bit confused with interfaces and abstract classes and I feel I dont fully grasp it like I thought I did. I think I'm using them incorrectly. I'll describe what I'm doing at the moment, the problem I have faced, and then hopefully it be clear what I'm doing wrong if anything. I wanted to write some classes that do ...

VB.NET Drag Drop If Object Implements Interface

I have to be missing something simple, but my brain is about to bleed on this. I have an interface, for the sake of argument called MyInterface. I Have a Control Class, lets name it "Parent" that implements MyInterface. I have another Control Class that inherits Parent, called "Child" I have a final Control Class lets call it "Contai...

How are vtables implemented in c++ and c#?

Lets have this situation (in c++, in c# classes A,B are interfaces): class A { virtual void func() = 0; }; class B { virtual void func() = 0; }; class X: public A, public B { virtual void func(){ var = 1; } int var;}; X * x = new X; // from what I know, x have 2 vtables, is this the same in c#? A * a = (A*)x; // a == x B * b = (B*)x; /...

difference betwenn abstract class and interface

Possible Duplicate: Interface vs Base class Hello all, I am not understanding difference between abstract class and interface, could you tell me please when I need to use which art of type. Thanks a lot and take care, Ragims ...

ASP.NET Passing values between classes using interface

Hi guys, I usually use STATIC implementation when developing Desktop Application and I just got my head bumped on the wall when I use STATIC in ASP.NET (not a good idea) I think I saw some feedback here before that you can use INTERFACE for passing values between Classes and Pages without using Session. Can you guys give a good examp...

Overwrite ActiveRecord's save method to use custom interface

Hello, I got the following situation: I have a rails application and two databases, one is for the Rails Application and the second database (running on the same DB Server Instance) is for a different non-web application. My Rails Web Application may read from the (second) Database directly via SQL but it can't write to it because of ...

interfaces, inheritance, and what between them

if i want to have 3 classes, which have common fields (and i want them to be static) and they have a common function (which needed to be overridden, i.e virtual) what the best design to do this? do i need to create an interface in a header file and then create it's .cpp file and get the 3 classes inheritance from it? what about the sta...

Coding to the interface using Entity Framework

I'm trying to wrap my head around the Entity Framework and am having trouble understanding how one would code to an interface (or, perhaps, whether coding to the interface is possible). I'm fairly confident in C#, but mostly due to my ability to program in so many other languages, so forgive any ignorances. Given: public interface IInp...