Click here to Skip to main content
15,893,161 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to know the dropped file path ? Pin
Xmen Real 29-Jun-08 14:05
professional Xmen Real 29-Jun-08 14:05 
QuestionGeneral Purpose Classes for Any Application Pin
ssclaire28-Jun-08 15:20
ssclaire28-Jun-08 15:20 
AnswerRe: General Purpose Classes for Any Application Pin
Mark Churchill28-Jun-08 17:03
Mark Churchill28-Jun-08 17:03 
QuestionHow to insert code snippet Pin
Imtiaz Murtaza28-Jun-08 12:27
Imtiaz Murtaza28-Jun-08 12:27 
AnswerRe: How to insert code snippet Pin
N a v a n e e t h28-Jun-08 17:00
N a v a n e e t h28-Jun-08 17:00 
GeneralRe: How to insert code snippet Pin
Alan N29-Jun-08 2:37
Alan N29-Jun-08 2:37 
GeneralRe: How to insert code snippet Pin
N a v a n e e t h29-Jun-08 7:31
N a v a n e e t h29-Jun-08 7:31 
QuestionWhat about the other use of generic base class und generic polymorphism ? Pin
MarkPhB28-Jun-08 11:30
MarkPhB28-Jun-08 11:30 
What about this use of generic base class und generic polymorphism ?

I found on the internet some Articles wich deal with generic base class and polymorphism but not in the following way. I know its not possible at the momenten but it should, i think.

Lets say we have class declarations like this
public class Range<T> {
    public T Start { get; set; }
    public T End { get; set; }
}

public class IntRange : Range<Int32> { }

public class DoubleRange : Range<Double> { }

public class DateTimeRange : Range<DateTime> { }

then we could use it in this way
Range<> range = new Range<float>();
range = new IntRange();

range = new DoubleRange();</float>

and so far the T contrain is naked then the compiler should assume the Property are from Type Object.
range = new IntRange();

object obj = range.Start; // should compile

int obj = range.Start; // don't compile

int obj = (int) range.Start; // should compile

or the T contrain is limited to a inheritance of ValueType.
public class Range<T> where T : ValueType {
    public T Start { get; set; }
    public T End { get; set; }
}

...

range = new IntRange();

int obj = range.Start; // should compile



So i think that should be possible, or what you think ?
AnswerRe: What about the other use of generic base class und generic polymorphism ? Pin
Christian Graus28-Jun-08 12:39
protectorChristian Graus28-Jun-08 12:39 
AnswerRe: What about the other use of generic base class und generic polymorphism ? [modified] Pin
Mark Churchill28-Jun-08 17:15
Mark Churchill28-Jun-08 17:15 
GeneralRe: What about the other use of generic base class und generic polymorphism ? Pin
MarkPhB29-Jun-08 1:12
MarkPhB29-Jun-08 1:12 
GeneralRe: What about the other use of generic base class und generic polymorphism ? Pin
Mark Churchill29-Jun-08 2:44
Mark Churchill29-Jun-08 2:44 
GeneralRe: What about the other use of generic base class und generic polymorphism ? Pin
MarkPhB29-Jun-08 4:50
MarkPhB29-Jun-08 4:50 
GeneralRe: What about the other use of generic base class und generic polymorphism ? Pin
Mark Churchill29-Jun-08 12:54
Mark Churchill29-Jun-08 12:54 
GeneralRe: What about the other use of generic base class und generic polymorphism ? Pin
MarkPhB1-Jul-08 1:40
MarkPhB1-Jul-08 1:40 
Questionc# double pointer Pin
wwwxyz28-Jun-08 11:24
wwwxyz28-Jun-08 11:24 
AnswerRe: c# double pointer Pin
Luc Pattyn28-Jun-08 12:12
sitebuilderLuc Pattyn28-Jun-08 12:12 
GeneralRe: c# double pointer Pin
wwwxyz28-Jun-08 18:40
wwwxyz28-Jun-08 18:40 
AnswerRe: c# double pointer Pin
Guffa28-Jun-08 23:41
Guffa28-Jun-08 23:41 
GeneralRe: c# double pointer Pin
Luc Pattyn29-Jun-08 2:20
sitebuilderLuc Pattyn29-Jun-08 2:20 
Questionproblem to Refresh Control after it's value changed. Pin
hdv21228-Jun-08 11:16
hdv21228-Jun-08 11:16 
AnswerRe: problem to Refresh Control after it's value changed. Pin
Luc Pattyn28-Jun-08 12:15
sitebuilderLuc Pattyn28-Jun-08 12:15 
GeneralRe: problem to Refresh Control after it's value changed. Pin
hdv21228-Jun-08 23:08
hdv21228-Jun-08 23:08 
GeneralRe: problem to Refresh Control after it's value changed. Pin
Luc Pattyn29-Jun-08 2:13
sitebuilderLuc Pattyn29-Jun-08 2:13 
GeneralRe: problem to Refresh Control after it's value changed. Pin
hdv21229-Jun-08 4:50
hdv21229-Jun-08 4:50 

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.