Click here to Skip to main content
15,894,343 members
Home / Discussions / C#
   

C#

 
AnswerRe: Memory Resource for a reader Pin
TJoe29-Nov-07 2:23
TJoe29-Nov-07 2:23 
QuestionSurrounding cities functionality Pin
cliffr195427-Nov-07 13:45
professionalcliffr195427-Nov-07 13:45 
AnswerRe: Surrounding cities functionality Pin
Colin Angus Mackay27-Nov-07 14:08
Colin Angus Mackay27-Nov-07 14:08 
QuestionProgram Complete Pin
MasterSharp27-Nov-07 13:18
MasterSharp27-Nov-07 13:18 
AnswerRe: Program Complete Pin
Christian Graus27-Nov-07 19:15
protectorChristian Graus27-Nov-07 19:15 
QuestionC# Factory Pattern Pin
Jeffrey Walton27-Nov-07 12:47
Jeffrey Walton27-Nov-07 12:47 
AnswerRe: C# Factory Pattern Pin
martin_hughes27-Nov-07 13:43
martin_hughes27-Nov-07 13:43 
GeneralRe: C# Factory Pattern Pin
Jeffrey Walton27-Nov-07 14:50
Jeffrey Walton27-Nov-07 14:50 
Hi Martin,

Thanks. It's been too long since I had a Design Patterns class (and I cannot find the text book from college).

In the examples, it seems Main() must know 'a priori' what classes to instaniate. Is this knowledge included in the Factory, or is this a poor example?

Perhaps if I briefly explain my problem domain, it will help cut to the chase.

Jeff

I parse a flat text file. Each token will become a distinct object. So I would like to:

Token t = NextToken()               // Base Class
Object o = Factory.CreateObject(t)  // Static method
o will then be Type1, Type2, Type3, etc. Factory::CreateObject would be a message cracker:
if( t.field = 1 ) { return new Type1(t); }
...
if( t.field = n ) { return new TypeN(t); }

GeneralRe: C# Factory Pattern Pin
martin_hughes28-Nov-07 3:19
martin_hughes28-Nov-07 3:19 
QuestionSimple question about ending loops Pin
falles0127-Nov-07 12:25
falles0127-Nov-07 12:25 
AnswerRe: Simple question about ending loops Pin
martin_hughes27-Nov-07 12:39
martin_hughes27-Nov-07 12:39 
GeneralRe: Simple question about ending loops Pin
falles0127-Nov-07 12:44
falles0127-Nov-07 12:44 
GeneralRe: Simple question about ending loops Pin
Colin Angus Mackay27-Nov-07 14:14
Colin Angus Mackay27-Nov-07 14:14 
GeneralRe: Simple question about ending loops Pin
martin_hughes27-Nov-07 14:52
martin_hughes27-Nov-07 14:52 
QuestionAutomatically generate Release Notes from code Pin
kozu27-Nov-07 10:31
kozu27-Nov-07 10:31 
AnswerCross post. Please ignore this thread. Pin
Pete O'Hanlon27-Nov-07 10:56
mvePete O'Hanlon27-Nov-07 10:56 
JokeRe: Cross post. Please ignore this thread. Pin
Paul Conrad27-Nov-07 12:23
professionalPaul Conrad27-Nov-07 12:23 
Questionpopulating a listview from another class Pin
kenwen27-Nov-07 9:55
kenwen27-Nov-07 9:55 
AnswerRe: populating a listview from another class Pin
pmarfleet27-Nov-07 10:19
pmarfleet27-Nov-07 10:19 
GeneralRe: populating a listview from another class Pin
kenwen27-Nov-07 10:37
kenwen27-Nov-07 10:37 
GeneralRe: populating a listview from another class Pin
pmarfleet27-Nov-07 10:49
pmarfleet27-Nov-07 10:49 
GeneralRe: populating a listview from another class Pin
kenwen27-Nov-07 10:57
kenwen27-Nov-07 10:57 
Questionwhen i can buy visual studio 2008 ? Pin
E_Gold27-Nov-07 8:55
E_Gold27-Nov-07 8:55 
AnswerWell Pin
Ennis Ray Lynch, Jr.27-Nov-07 8:58
Ennis Ray Lynch, Jr.27-Nov-07 8:58 
GeneralRe: Well Pin
Christian Graus27-Nov-07 9:21
protectorChristian Graus27-Nov-07 9:21 

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.