interface

Use interface between model and view in ASP.NET MVC

Hi, I am using asp.net MVC 2 to develop a site. IUser is used to be the interface between model and view for better separation of concern. However, things turn to a little messy here. In the controller that handles user sign on: I have the following: IUserBll userBll = new UserBll(); IUser newUser = new User(); ...

Custom context menu with 2 columns

is it possible to make two columns in context menu ? If so - how ? WinForms, .net 2.0 ...

DB Interface Design Optimization: Is it better to optimise for Fewer requests of smaller data size?

The prevailing wisdom in webservices/web requests in general is to design your api such that you use as few requests as possible, and that each request returns therefore as much data as is needed In database design, the accepted wisdom is to design your queries to minimise size over the network, as opposed to minimizing the number of qu...

Safe & Simple Access to Explicit Interface Members in C#

When I am working with explicit interface implementations in C#, it often becomes necessary to cast an object to one of its interfaces in order to access a member of that interface. Because of the improved reliability and maintainability afforded by compile time type checking, I have always preferred to use implicit conversions to perfor...

why does my C# client that uses Library A need to have a using statement for Library B (which A uses)

Hi, I have: Main Program Class - uses Library A Library A - has partial classes which mix in methods from Library B Library B - mix in methods & interfaces So in Library B when I include a partial Node class which implements INode (defined in Library B) I suddenly get an error in my main class where it uses Node from Library A. The...

Best way to implement some type of ITaggable interface

I've got a program I'm creating that reports on another certain programs backup xml files. I've gotten to the point where I need to implement some type of ITaggable interface - but am unsure how to go about it code wise. My idea is that each item (BackupClient, BackupVersion, and BackupFile) should implement an ITaggable interface for h...

Unresolved symbol when inheriting interface

It's late at night here and I'm going crazy trying to solve a linker error. If I have the following abstract interface: class IArpPacketBuilder { public: IArpPacketBuilder(const DslPortId& aPortId); virtual ~IArpPacketBuilder(); // Other abstract (pure virtual methods) here... }; and I instantiate it like this: class D...

ArrayAccess multidimensional (un)set?

I have a class implementing ArrayAccess and I'm trying to get it to work with a multidimensional array. exists and get work. set and unset are giving me a problem though. class ArrayTest implements ArrayAccess { private $_arr = array( 'test' => array( 'bar' => 1, 'baz' => 2 ) ); publi...

Custom Collection Implementing IEnumerable

I know that technically, an Interface is used for reading and not writting or editing however, I want to add an add and addrange function to the following class, here is what I currently have which is not working public class HrefCollection : IEnumerable<Href> { private IEnumerable<Href> hrefs; public IEnumerable<Href> Add( Hr...

slsvcutil.exe Proxy and Interfaces

Is it possible when using slsvcutil.exe to generate a proxy through the command line not to have the proxy file output the Interface in an Asynchronous fashion. For example, if I have a function "foo()" on the serverside in the Interface, when I generate the proxy using Slsvcutil.exe, it makes two functions in the interface definition i...

Question about the Cloneable interface and the exception that should be thrown

Hi, The Java documentation says: A class implements the Cloneable interface to indicate to the Object.clone() method that it is legal for that method to make a field-for-field copy of instances of that class. Invoking Object's clone method on an instance that does not implement the Cloneable interface results in ...

Question about gets and sets and when to use super classes

Hi, I have the following get method: public List<PersonalMessage> getMessagesList() { List<PersonalMessage> newList = new ArrayList<PersonalMessage>(); for(PersonalMessage pMessage : this.listMessages) { newList.add(pMessage.clone()); } return newList; } And you can see that if I need to change the implement...

selecting ppp of multiple interfaces

Hi everyone, I am currently having a hard time on getting the mobile broadband connection running on ubuntu 10.04(lucid lynx). I am using a USB modem and used wvdial to connect to the web It went like: Sending ATZ ... OK sending some more flags OK modem initialized connecting Local IP x.x.x.x Remote IP y.y.y.y Primary DNS z.z.z.z Seco...

Implementing multiple properties in different namespaces

I tried to implement IEnumerator< Status > but got errors about two different Properties not being implemented. 'DataReader' does not implement interface member 'System.Collections.Generic.IEnumerator.Current' 'DataReader' does not implement interface member 'System.Collections.IEnumerator.Current' The solution that wo...

Why can I not convert from List<IScreen> to List<IRenderable> even when IScreen implements IRenderable?

Pretty self explanatory question, glad for any answer. For me it doesn't make sense. I don't care about losing information. I just want to concatenate all my lists that inherit IRenderable somehow into a single list and then call IRenderable methods on it. I have a feeling that this is some basic rule of programming I forgot... edit: T...

Why C++ virtual function defined in header may not be compiled and linked in vtable?

Situation is following. I have shared library, which contains class definition - QueueClass : IClassInterface { virtual void LOL() { do some magic} } My shared library initialize class member QueueClass *globalMember = new QueueClass(); My share library export C function which returns pointer to globalMember - void * getGlobal...

Casting an object to two interfaces at the same time, to call a generic method

I want to call a generic method that constrains the input type T to implement two interfaces: interface IA { } interface IB { } void foo<T>(T t) where T : IA, IB { } How can I fix the last line of void bar(object obj) { if (obj is IA && obj is IB) { foo((IA && IB)obj); } } ? Reflection probably allows to do th...

Break a class in twain, or impose an interface for restricted access?

What's the best way of partitioning a class when its functionality needs to be externally accessed in different ways by different classes? Hopefully the following example will make the question clear :) I have a Java class which accesses a single location in a directory allowing external classes to perform read/write operations to it. ...

pass fortran 77 function to C/C++

hello. Is it possible to pass fortran 77 function as a callback function pointer to C/C++? if so, how? information I found on the web relates to fortran 90 and above, but my legacy code base is in 77. many thanks ...

C# casting question: from IEnumerable to custom type

I have a custom class called Rows that implements IEnumerable<Row>. I often use LINQ queries on Rows instances: Rows rows = new Rows { row1, row2, row3 }; IEnumerable<Row> particularRows = rows.Where<Row>(row => condition); What I would like is to be able to do the following: Rows rows = new Rows { row1, row2, row3 }; Rows particula...