Generic Type as Parameters
CapableObjects Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Generic Type as Parameters Expand / Collapse
Author
Message
Posted 2009-01-29 15:23:05
Forum Guru

Forum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum Guru

Group: Forum Members
Last Login: 2011-08-30 12:38:11
Posts: 61, Visits: 183
Hi, I want to create a function returning a generic type, if I do :

public static IEcoList<VmVersion> SelectVmVersion(string pQuery) {
return SelectBoldElement(null, pQuery, false).GetAsEcoList<VmVersion>();
}

ok, but I want a generic function of the type:
        public static IEcoList<T> SelectVmVersion(string pQuery) {
return SelectBoldElement(null, pQuery, false).GetAsEcoList<T>();
}

But it doesen't compile any idea?
Post #2018
Posted 2009-01-29 15:47:46
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: 2010-11-30 12:17:13
Posts: 1 230, Visits: 1 382
This is the method declaration you want:


public static IEcoList<T> SelectVmVersion<T>(string pQuery) where T: class, IEcoObject
{
}



/Jonas Hogstrom [CapableObjects]
Post #2020
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: HansKarlsen, Jonas Hogstrom, PeterMorris

Permissions Expand / Collapse

All times are GMT +1:00, Time now is 9:40

Powered By InstantForum.NET v4.1.4 © 2012
Execution: 0,109. 6 queries. Compression Disabled.