Click here to Skip to main content
15,894,955 members
Home / Discussions / C#
   

C#

 
GeneralRe: asp controls in web application Pin
dan!sh 27-Feb-09 22:14
professional dan!sh 27-Feb-09 22:14 
AnswerRe: asp controls in web application Pin
Calin Tatar28-Feb-09 0:34
Calin Tatar28-Feb-09 0:34 
QuestionBHO and cookies ? Pin
tsahiB27-Feb-09 21:24
tsahiB27-Feb-09 21:24 
QuestionLooking for tips & tricks Pin
E_Gold27-Feb-09 20:08
E_Gold27-Feb-09 20:08 
AnswerRe: Looking for tips & tricks Pin
Abhijit Jana27-Feb-09 20:42
professionalAbhijit Jana27-Feb-09 20:42 
GeneralRe: Looking for tips & tricks Pin
E_Gold27-Feb-09 21:14
E_Gold27-Feb-09 21:14 
AnswerRe: Looking for tips & tricks Pin
Eddy Vluggen27-Feb-09 22:31
professionalEddy Vluggen27-Feb-09 22:31 
QuestionProblem with Generic Collection and Interface Pin
_ro_bb_o27-Feb-09 19:06
_ro_bb_o27-Feb-09 19:06 
Hi,

I am having trouble using interfaces with a Generic List. I have taken an extract of my problem below which consists of two interfaces, one for a single object (itemInterface) and one for a collection of those objects (collectionInterface) and then the objects that implement these interfaces. Client and ClientCollection.


public interface CollectionInterface
{
bool IsServer
{
get;
set;
}

void LoadServerInserts(DateTime lastSync);
void LoadClientInserts();
void LoadServerUpdates(DateTime lastSync);
void LoadClientUpdates();
void LoadClientDeletes();
void LoadServerDeletes();
void RunCommand(string sql, bool isServer);

}

public interface ItemInterface
{
bool IsServer
{
get;
set;
}

bool IsNew
{
get;
set;
}

void Save(bool includeSyncBit);

void ClearSync();
}

Client : ItemInterface
{
//client related stuff inlcuding interface methods and members
}

ClientCollection : System.Collections.Generic.List<Client>, CollectionInterface
{
//client collection related stuff inlcuding interface methods and members
}

When I try and use these objects on a form I get the error:

foreach statement cannot operate on variables of type 'CollectionInterface' because 'CollectionInterface' does not contain a public definition for 'GetEnumerator'

This is on my windows form....

private void doSomething CollectionInterface a, CollectionInterface b, CollectionInterface conflicts)
{

//update the server with the client updates
foreach (ItemInterface item in a)
{
if ( b.Contains(row))
{
conflicts.Add(row);
}
}
}

I wondered if I needed to change the collection interface as follows:

public interface CollectionInterface:IList<ItemInterface>

But this gave me even more errors.

I would be really really grateful for any help on this, I have been tearing my hair out over the last few hours
AnswerRe: Problem with Generic Collection and Interface Pin
DaveyM6928-Feb-09 2:40
professionalDaveyM6928-Feb-09 2:40 
QuestionReading a Packet assistance Pin
Andrew Timmins27-Feb-09 18:46
Andrew Timmins27-Feb-09 18:46 
AnswerRe: Reading a Packet assistance Pin
Jimmanuel28-Feb-09 1:43
Jimmanuel28-Feb-09 1:43 
QuestionTo Create Crystal Reports With Dynamic Values Pin
aashish.saalvi27-Feb-09 18:46
aashish.saalvi27-Feb-09 18:46 
QuestionC# drag and drop from Treeview to Listview Pin
AlCsharp27-Feb-09 18:01
AlCsharp27-Feb-09 18:01 
AnswerRe: C# drag and drop from Treeview to Listview Pin
Calin Tatar28-Feb-09 1:02
Calin Tatar28-Feb-09 1:02 
QuestionAny good .net obfuscator ? Pin
Kim061827-Feb-09 15:11
Kim061827-Feb-09 15:11 
AnswerRe: Any good .net obfuscator ? Pin
Eddy Vluggen27-Feb-09 23:05
professionalEddy Vluggen27-Feb-09 23:05 
Questionthe problem of set the default page for html help maker (.chm) Pin
Seraph_summer27-Feb-09 10:43
Seraph_summer27-Feb-09 10:43 
QuestionDirectory of the App file ? Pin
Mohammad Dayyan27-Feb-09 10:01
Mohammad Dayyan27-Feb-09 10:01 
AnswerRe: Directory of the App file ? Pin
Calin Tatar27-Feb-09 10:02
Calin Tatar27-Feb-09 10:02 
GeneralRe: Directory of the App file ? Pin
Mohammad Dayyan27-Feb-09 10:05
Mohammad Dayyan27-Feb-09 10:05 
QuestionUsb control channel and buzzer Pin
thomaxz.tc27-Feb-09 8:52
thomaxz.tc27-Feb-09 8:52 
AnswerRe: Usb control channel and buzzer Pin
Curtis Schlak.27-Feb-09 11:43
Curtis Schlak.27-Feb-09 11:43 
GeneralRe: Usb control channel and buzzer Pin
thomaxz.tc28-Feb-09 4:09
thomaxz.tc28-Feb-09 4:09 
QuestionProblem In Middle Tire Pin
naim khan27-Feb-09 8:19
naim khan27-Feb-09 8:19 
AnswerRe: Problem In Middle Tire Pin
Colin Angus Mackay27-Feb-09 10:19
Colin Angus Mackay27-Feb-09 10:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.