Click here to Skip to main content
15,889,648 members
Home / Discussions / C#
   

C#

 
AnswerRe: Settings/reading files attributes Pin
Pete O'Hanlon30-Sep-11 0:44
mvePete O'Hanlon30-Sep-11 0:44 
QuestionConstructing a Generic Class from several similar classes Pin
Wayne Gaylard29-Sep-11 23:21
professionalWayne Gaylard29-Sep-11 23:21 
AnswerRe: Constructing a Generic Class from several similar classes Pin
Pete O'Hanlon29-Sep-11 23:50
mvePete O'Hanlon29-Sep-11 23:50 
GeneralRe: Constructing a Generic Class from several similar classes Pin
Wayne Gaylard30-Sep-11 1:10
professionalWayne Gaylard30-Sep-11 1:10 
AnswerRe: Constructing a Generic Class from several similar classes Pin
lukeer30-Sep-11 1:21
lukeer30-Sep-11 1:21 
GeneralRe: Constructing a Generic Class from several similar classes Pin
Wayne Gaylard30-Sep-11 1:48
professionalWayne Gaylard30-Sep-11 1:48 
GeneralRe: Constructing a Generic Class from several similar classes Pin
lukeer30-Sep-11 2:55
lukeer30-Sep-11 2:55 
AnswerRe: Constructing a Generic Class from several similar classes Pin
BobJanova30-Sep-11 2:29
BobJanova30-Sep-11 2:29 
I think you need to explain more thoroughly what you are actually trying to do. The list of 'lots of stuff' seems confused and that should almost certainly be a List<BaseClass> (or an interface, possibly) where BaseClass defines all the things that you want to do on the different MyClass types.

Similar to the answer above, I would factor out the common, non generic parts into a base class (note that this isn't necessarily the same BaseClass referenced in the first paragraph, though it could be; the question is not detailed enough to be able to tell):
public abstract class BaseClass {
 public int x;
 public string y;
 public virtual IEnumerable BaseDetails { get; set; }
}


public class MyClass<T> : BaseClass {
 public IList<T> Details { get; set; }
 public override IEnumerable BaseDetails {
  get { return Details; }
  // The setter will fail if it's the wrong type, probably
  // what you want
  set { Details = (IList<T>)value; }
 }
}


BaseClass should also define virtual methods for whatever operations you are going to want to do on things pulled out of the list.
AnswerRe: Constructing a Generic Class from several similar classes Pin
Luc Pattyn30-Sep-11 2:40
sitebuilderLuc Pattyn30-Sep-11 2:40 
QuestionHow to use TextBoxRenderer in usercontrol Pin
Arjen H.29-Sep-11 21:11
Arjen H.29-Sep-11 21:11 
AnswerRe: How to use TextBoxRenderer in usercontrol Pin
Pete O'Hanlon29-Sep-11 22:31
mvePete O'Hanlon29-Sep-11 22:31 
GeneralRe: How to use TextBoxRenderer in usercontrol Pin
Arjen H.29-Sep-11 23:03
Arjen H.29-Sep-11 23:03 
QuestionHow to Controls the threads Pin
Anubhava Dimri29-Sep-11 20:04
Anubhava Dimri29-Sep-11 20:04 
AnswerRe: How to Controls the threads Pin
OriginalGriff29-Sep-11 21:37
mveOriginalGriff29-Sep-11 21:37 
QuestionProblem in facebook app using C# sdk Pin
rahul_galgali29-Sep-11 19:05
rahul_galgali29-Sep-11 19:05 
AnswerRe: Problem in facebook app using C# sdk Pin
killabyte29-Sep-11 20:14
killabyte29-Sep-11 20:14 
GeneralRe: Problem in facebook app using C# sdk Pin
rahul_galgali29-Sep-11 20:58
rahul_galgali29-Sep-11 20:58 
AnswerRe: Problem in facebook app using C# sdk Pin
Richard MacCutchan29-Sep-11 22:18
mveRichard MacCutchan29-Sep-11 22:18 
AnswerRe: Problem in facebook app using C# sdk Pin
Eddy Vluggen30-Sep-11 6:51
professionalEddy Vluggen30-Sep-11 6:51 
QuestionBeginner C# developer question Pin
SFORavi29-Sep-11 9:44
SFORavi29-Sep-11 9:44 
AnswerRe: Beginner C# developer question Pin
DaveyM6929-Sep-11 9:53
professionalDaveyM6929-Sep-11 9:53 
GeneralRe: Beginner C# developer question Pin
SFORavi29-Sep-11 10:08
SFORavi29-Sep-11 10:08 
GeneralMessage Removed Pin
29-Sep-11 10:14
professionalN_tro_P29-Sep-11 10:14 
GeneralRe: Beginner C# developer question Pin
SFORavi29-Sep-11 11:42
SFORavi29-Sep-11 11:42 
AnswerRe: Beginner C# developer question Pin
Perić Željko6-Oct-11 9:06
professionalPerić Željko6-Oct-11 9:06 

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.