Hi,

You have to supply a <T> argument with the interface:

using System;
using System.Collections.Generic;
using System.Text;

    public interface IDataManager<T>
    {
                List<T> SelectData();
                int UpdateData(T objectToBeUpdated);
                bool InsertData(T objectToBeInserted);
                bool DeleteData(T objectToBeDeleted);
    }

Regards,
Bruno

-----Ursprüngliche Nachricht-----
Von: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Im Auftrag von Alvarado, Yago
Gesendet: Montag, 27. März 2006 13:39
An: [email protected]
Betreff: [ADVANCED-DOTNET] Generics. How can I do a generic declaration?

Hi all,

   I'm having a problem that I'm quite sure is quite simple to solve but
for some reason I just can get it to work.

All I want to do is to create an interface such as the following:

------------------------------------------------------------------------
-----------------------------

using System;
using System.Collections.Generic;
using System.Text;

    public interface IDataManager
    {
        List<T> SelectData();
          int UpdateData(<T> objectToBeUpdated);
          bool InsertData(<T> objectToBeInserted);
          bool DeleteData(<T> objectToBeDeleted);
    }

------------------------------------------------------------------------
-----------------------------

According to all the documentation I've read, this shouldn't be a problem,
but every time I try to compile, the following compile error is thrown:

Error   1       The type or namespace name 'T' could not be found (are
you missing a using directive or an assembly reference?)


This is probably blatantly obvious for most of you but I just haven't find
a way to solve the problem. 

I am assuming I have to tell the compiler that T will be a generic type
but I haven't found a way of doing it and as all the documentation and
examples I've seen don't mentione it, it makes me think it's something
very obvious...(not for me though).
What is it that I am missing?

Is there a secret reference I should be adding?
Maybe a secret using statement that I am missing?


Any ideas?


Thanks in advance,
Yago Alvarado

- -----------
Marketing Magazine's Contact Centre Agency of the Year 2005 Field
Marketing Gold - DMA / Royal Mail Awards Best Overall Site - British Gas
Outbound Sales Awards

http://www.cpm-int.com
- -----------

_____________________________________________________________________
This e-mail is confidential and is intended solely for the use of the
individual or entity to whom it is addressed.  If you are not the intended
recipient and you have received this e-mail in error then any use,
dissemination, forwarding, printing or copying of this e-mail is strictly
prohibited. You should contact the sender by return e-mail and delete and
destroy all the information from your system.  Any views or opinions
presented are solely those of the author and do not necessarily represent
those of CPM.  This email does not form part of a legally binding
agreement.  We have taken precautions to minimise the risk of transmitting
software viruses or trojans, but we advise that you carry out your own
virus checks on any attachments to this message.  We cannot accept
liability for any loss or damage caused to your software, hardware or
system.

Please note that all messages sent to CPM are actively monitored for
inappropriate material and/ or content.

===================================
This list is hosted by DevelopMentor.  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

http://www.gildemeister.com
_______________________________________________________________________

                        E-Mail Disclaimer

Der Inhalt dieser E-Mail ist ausschliesslich fuer den/die bezeichneten
Empfaenger bestimmt. Wenn Sie nicht der vorgesehene Adressat dieser
E-Mail oder dessen Vertreter sein sollten, so beachten Sie bitte, dass
jede Form der Kenntnisnahme, Veroeffentlichung, Vervielfaeltigung oder
Weitergabe des Inhalts dieser E-Mail unzulaessig ist. Wir bitten Sie,
sich in diesem Fall mit dem Absender der E-Mail in Verbindung zu
setzen. 
Wir moechten Sie ausserdem darauf hinweisen, dass die Kommunikation per
E-Mail ueber das Internet unsicher ist, da fuer unberechtigte Dritte
grundsaetzlich die Moeglichkeit der Kenntnisnahme und Manipulation
besteht.



The information contained in this email is intended solely for the
recipient(s). Access to this email by anyone else is unauthorized. If you
are not the intended recipient, any form of disclosure, reproduction,
distribution or any action taken or refrained from in reliance on it,
is prohibited. Please notify the sender of this E-Mail immediately. 

We also like to inform you that communication via email over the 
internet is insecure because third parties may have the possibility 
to access and manipulate emails.

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to