Click here to Skip to main content
15,917,481 members
Home / Discussions / C#
   

C#

 
GeneralRe: building a c# project Pin
waheed awan7-Sep-06 6:28
waheed awan7-Sep-06 6:28 
QuestionHow I can fill up the DataGridView with empy rows Pin
unikum6-Sep-06 18:07
unikum6-Sep-06 18:07 
QuestionCreating Installation file Pin
Niiiissssshhhhhuuuuu6-Sep-06 17:51
Niiiissssshhhhhuuuuu6-Sep-06 17:51 
AnswerRe: Creating Installation file Pin
Utkarshraj Atmaram6-Sep-06 18:55
Utkarshraj Atmaram6-Sep-06 18:55 
QuestionNested Collections Pin
xfitr26-Sep-06 17:05
xfitr26-Sep-06 17:05 
AnswerRe: Nested Collections Pin
MIHAI_MTZ6-Sep-06 21:01
MIHAI_MTZ6-Sep-06 21:01 
QuestionYour favourite/best C# 2.0 Book? Pin
James_1236-Sep-06 15:38
James_1236-Sep-06 15:38 
AnswerRe: Your favourite/best C# 2.0 Book? Pin
Andrei Ungureanu6-Sep-06 20:00
Andrei Ungureanu6-Sep-06 20:00 
QuestionHelp ThreadPools/Threads Pin
peterzorbas6-Sep-06 13:30
peterzorbas6-Sep-06 13:30 
QuestionCopy and Past shortcuts stop working when derived form shown non-modally. Pin
Vengeance6-Sep-06 12:50
Vengeance6-Sep-06 12:50 
Questiongeneric inherited class Pin
daveroberge6-Sep-06 9:33
daveroberge6-Sep-06 9:33 
AnswerRe: generic inherited class Pin
Nader Elshehabi6-Sep-06 10:17
Nader Elshehabi6-Sep-06 10:17 
GeneralRe: generic inherited class Pin
daveroberge6-Sep-06 10:46
daveroberge6-Sep-06 10:46 
QuestionRe: generic inherited class Pin
Nader Elshehabi6-Sep-06 11:30
Nader Elshehabi6-Sep-06 11:30 
AnswerRe: generic inherited class Pin
daveroberge6-Sep-06 14:04
daveroberge6-Sep-06 14:04 
AnswerRe: generic inherited class Pin
Nader Elshehabi7-Sep-06 1:59
Nader Elshehabi7-Sep-06 1:59 
GeneralRe: generic inherited class Pin
daveroberge7-Sep-06 3:07
daveroberge7-Sep-06 3:07 
GeneralRe: generic inherited class Pin
Nader Elshehabi7-Sep-06 9:04
Nader Elshehabi7-Sep-06 9:04 
GeneralRe: generic inherited class Pin
daveroberge7-Sep-06 10:53
daveroberge7-Sep-06 10:53 
GeneralRe: generic inherited class Pin
Nader Elshehabi7-Sep-06 11:26
Nader Elshehabi7-Sep-06 11:26 
GeneralRe: generic inherited class Pin
daveroberge7-Sep-06 14:31
daveroberge7-Sep-06 14:31 
AnswerRe: generic inherited class Pin
Ed.Poore6-Sep-06 12:01
Ed.Poore6-Sep-06 12:01 
First of all (I don't know if this is because you stipped out the <> tags), your interface I1 does not expose a generic type, it should be declared as
interface I1<T>
{
	void meth(T t);
}
Unless of course I1 is declared inside another generic class which exposes the generic type T, but from your code this is not the case.

The same applies for the declarations of g1 and g2, you need to include the <T> after the name (unless it's part of a parent class).  Then everything should work.  Although in your lines of code which create the generics you will need to specify which type to implement: e.g.
I1 ol1 = null;
g2 = og2 = new g2<int>();
ol1 = (I1) og2;
So in summary your code should probably look along the lines of
class c1
{
}
class c2 : c1
{
}

interface I1<T>
{
    void meth(T t);
    {
    }
}

class g1<T> : I1 where T : c1
{
}
class g2<T> : g1 where T : c2
{
}

static void Main(...)
{
    I1<object> oI1 = null;
    g2 og2 = new g2<object>();
    oI1 = (I1)og2;
}
Of couse this would be much nicer if the variables and types were named more appropriately.



As of how to accomplish this I have no idea, have you tried Google?
Faiing that try Badger | [badger,badger,badger,badger...] Badger | [badger,badger,badger,badger...] Badger | [badger,badger,badger,badger...]

GeneralRe: generic inherited class Pin
daveroberge6-Sep-06 14:09
daveroberge6-Sep-06 14:09 
GeneralRe: generic inherited class Pin
Ed.Poore6-Sep-06 18:38
Ed.Poore6-Sep-06 18:38 
GeneralRe: generic inherited class Pin
daveroberge7-Sep-06 2:54
daveroberge7-Sep-06 2:54 

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.