Click here to Skip to main content
15,902,032 members
Home / Discussions / C#
   

C#

 
AnswerRe: Downloading file from remote location Pin
kaliem2-Jul-07 8:00
kaliem2-Jul-07 8:00 
AnswerRe: Downloading file from remote location Pin
Not Active2-Jul-07 8:05
mentorNot Active2-Jul-07 8:05 
GeneralRe: Downloading file from remote location Pin
kaliem2-Jul-07 8:18
kaliem2-Jul-07 8:18 
GeneralRe: Downloading file from remote location Pin
Not Active2-Jul-07 8:43
mentorNot Active2-Jul-07 8:43 
GeneralRe: Downloading file from remote location Pin
kaliem2-Jul-07 10:07
kaliem2-Jul-07 10:07 
GeneralRe: Downloading file from remote location Pin
Scott Dorman2-Jul-07 10:43
professionalScott Dorman2-Jul-07 10:43 
GeneralRe: Downloading file from remote location Pin
Not Active2-Jul-07 10:59
mentorNot Active2-Jul-07 10:59 
QuestionC# Generic: Is this a bug or by design Pin
mschuckmann2-Jul-07 7:37
mschuckmann2-Jul-07 7:37 
Given the following class hierarchy and simple Program.Main

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

namespace GenericTest
{

class Base
{
public void Name()
{
Console.WriteLine("I'm a Base class");
}
};

class Middle : Base
{
public new void Name()
{
Console.Write("I'm a Middle class");
}
};

class Child : Middle
{
public new void Name()
{
Console.Write("I'm a Child class");
}
};


class Program
{

static void PrintName<t>( T instance ) where T : GenericTest.Base
{
instance.Name();
}

static void Main(string[] args)
{
Child c = new Child();
PrintName<child>( c );
}
}
}


I see the following output
I'm a Base class
And I would have expected to see
I'm a Child class

Is this a bug with Generics or is it a side effect of how the Generic is generated for reference types?

Thanks
Matt Schuckmann
AnswerRe: C# Generic: Is this a bug or by design Pin
Luc Pattyn2-Jul-07 8:03
sitebuilderLuc Pattyn2-Jul-07 8:03 
GeneralRe: C# Generic: Is this a bug or by design Pin
mschuckmann2-Jul-07 8:26
mschuckmann2-Jul-07 8:26 
GeneralRe: C# Generic: Is this a bug or by design Pin
Luc Pattyn2-Jul-07 9:08
sitebuilderLuc Pattyn2-Jul-07 9:08 
GeneralRe: C# Generic: Is this a bug or by design Pin
mschuckmann2-Jul-07 11:28
mschuckmann2-Jul-07 11:28 
GeneralRe: C# Generic: Is this a bug or by design Pin
Tim Paaschen2-Jul-07 20:36
Tim Paaschen2-Jul-07 20:36 
QuestionMultiview Databinding Pin
stormcandi2-Jul-07 6:19
stormcandi2-Jul-07 6:19 
AnswerRe: Multiview Databinding Pin
Sathesh Sakthivel2-Jul-07 16:22
Sathesh Sakthivel2-Jul-07 16:22 
QuestionInsert from DataTable into an SQL Table Pin
kissa492-Jul-07 5:52
kissa492-Jul-07 5:52 
JokeRe: Insert from DataTable into an SQL Table Pin
Ed.Poore2-Jul-07 6:13
Ed.Poore2-Jul-07 6:13 
GeneralRe: Insert from DataTable into an SQL Table Pin
kissa492-Jul-07 6:36
kissa492-Jul-07 6:36 
GeneralRe: Insert from DataTable into an SQL Table Pin
Ed.Poore2-Jul-07 6:54
Ed.Poore2-Jul-07 6:54 
GeneralRe: Insert from DataTable into an SQL Table Pin
leppie2-Jul-07 7:21
leppie2-Jul-07 7:21 
QuestionRe: Insert from DataTable into an SQL Table Pin
kissa492-Jul-07 8:34
kissa492-Jul-07 8:34 
AnswerRe: Insert from DataTable into an SQL Table Pin
PIEBALDconsult2-Jul-07 11:05
mvePIEBALDconsult2-Jul-07 11:05 
GeneralRe: Insert from DataTable into an SQL Table Pin
kissa492-Jul-07 11:06
kissa492-Jul-07 11:06 
GeneralRe: Insert from DataTable into an SQL Table Pin
PIEBALDconsult3-Jul-07 7:07
mvePIEBALDconsult3-Jul-07 7:07 
GeneralRe: Insert from DataTable into an SQL Table Pin
kissa493-Jul-07 8:18
kissa493-Jul-07 8:18 

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.