Click here to Skip to main content
15,914,013 members
Home / Discussions / C#
   

C#

 
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 
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 
I'm not sure where the percieved benefit of having a concrete IntRange deriving from a Range< T >. Generics are specialization, not inheritance. Sometimes covariance/contravariance (always forget which way those go) is appropriate, but it generally leads to breaking type safety. As generics are generally used to provide type safety then you would be defeating one of their main purposes.

I would suggest the correct way of implementing and using a generic Range class would be along the lines of:

class Range< T > where T : IComparable< T >
{
  T Start;
  T End;
  bool IsBetween(T i) => Start.CompareTo(i) < 0 && End.CompareTo(i) > 0;
}


Then the usage is trivial. No need for an abstract generic class with concrete types.


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 
QuestionProblem with WebBrowser.DocumentText Pin
That Asian Guy28-Jun-08 10:43
That Asian Guy28-Jun-08 10:43 
GeneralRe: Problem with WebBrowser.DocumentText Pin
That Asian Guy28-Jun-08 12:51
That Asian Guy28-Jun-08 12:51 
QuestionSaveing tabs and content when closing app Pin
SilverAdder28-Jun-08 9:59
SilverAdder28-Jun-08 9:59 
AnswerRe: Saveing tabs and content when closing app Pin
Giorgi Dalakishvili28-Jun-08 10:49
mentorGiorgi Dalakishvili28-Jun-08 10:49 

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.