Click here to Skip to main content
15,913,027 members
Home / Discussions / C#
   

C#

 
GeneralRe: Newbie Inheritance Question Pin
Łukasz Nowakowski28-Jun-10 4:43
Łukasz Nowakowski28-Jun-10 4:43 
GeneralRe: Newbie Inheritance Question Pin
Richard MacCutchan28-Jun-10 4:55
mveRichard MacCutchan28-Jun-10 4:55 
GeneralRe: Newbie Inheritance Question Pin
Łukasz Nowakowski28-Jun-10 4:58
Łukasz Nowakowski28-Jun-10 4:58 
GeneralRe: Newbie Inheritance Question Pin
Ennis Ray Lynch, Jr.28-Jun-10 5:00
Ennis Ray Lynch, Jr.28-Jun-10 5:00 
AnswerRe: Newbie Inheritance Question Pin
PIEBALDconsult28-Jun-10 13:55
mvePIEBALDconsult28-Jun-10 13:55 
QuestionSimilation of UPnP device in C# Pin
Eduard Meciar28-Jun-10 3:18
Eduard Meciar28-Jun-10 3:18 
AnswerRe: Similation of UPnP device in C# Pin
Ravi Bhavnani28-Jun-10 3:53
professionalRavi Bhavnani28-Jun-10 3:53 
QuestionUse of design?? Pin
sujithkumarsl28-Jun-10 2:31
sujithkumarsl28-Jun-10 2:31 
Can anybody tell the exact use of design/design patterns in C#.

Let me come with an example, i am designing a software for processing different type of input files. My design will be like this.
I will have a baseclass
class BaseFileClass
{
    protected void ProcessFile();
}


Then the derived classes
class XMLClass : BaseFileClass
{
    public override void ProcessFile()
    {
        //Process XML File
    }
}

class CSVCLass: BaseFileClass
{
    public override void ProcessFile()
    {
        //Process CSV File
    }
}


class ExcelClass: BaseFileClass
{
    public override void ProcessFile()
    {
        //Process Excel File
    }
}


On the main
Base b = null;
if( isXMl)
{
    b = new XMLCLass();
}
else if( isExcel)
{
    b = new ExcelCLass();
}
else if( isCSV)
{
    b = new CSVCLass();
}

b.ProcessFile();


What are the uses of this kind of a design??
My small attempt...

AnswerRe: Use of design?? Pin
PIEBALDconsult28-Jun-10 2:54
mvePIEBALDconsult28-Jun-10 2:54 
GeneralRe: Use of design?? Pin
sujithkumarsl28-Jun-10 2:57
sujithkumarsl28-Jun-10 2:57 
GeneralRe: Use of design?? Pin
PIEBALDconsult28-Jun-10 3:03
mvePIEBALDconsult28-Jun-10 3:03 
AnswerRe: Use of design?? Pin
yu-jian28-Jun-10 4:44
yu-jian28-Jun-10 4:44 
GeneralRe: Use of design?? Pin
PIEBALDconsult28-Jun-10 13:52
mvePIEBALDconsult28-Jun-10 13:52 
GeneralRe: Use of design?? Pin
yu-jian28-Jun-10 21:11
yu-jian28-Jun-10 21:11 
AnswerRe: Use of design?? Pin
T M Gray28-Jun-10 7:28
T M Gray28-Jun-10 7:28 
GeneralRe: Use of design?? Pin
sujithkumarsl28-Jun-10 17:50
sujithkumarsl28-Jun-10 17:50 
GeneralRe: Use of design?? Pin
PIEBALDconsult28-Jun-10 17:57
mvePIEBALDconsult28-Jun-10 17:57 
GeneralRe: Use of design?? Pin
T M Gray29-Jun-10 10:31
T M Gray29-Jun-10 10:31 
AnswerRe: Use of design?? Pin
Alan Balkany29-Jun-10 5:10
Alan Balkany29-Jun-10 5:10 
QuestionCalling function of other application? Pin
Hum Dum28-Jun-10 1:30
Hum Dum28-Jun-10 1:30 
AnswerRe: Calling function of other application? Pin
Gonzalo Cao28-Jun-10 5:53
Gonzalo Cao28-Jun-10 5:53 
QuestionWhat is Root in Garbage Collector(GC)? Pin
Praveen Raghuvanshi28-Jun-10 0:41
professionalPraveen Raghuvanshi28-Jun-10 0:41 
AnswerRe: What is Root in Garbage Collector(GC)? Pin
riced28-Jun-10 2:24
riced28-Jun-10 2:24 
QuestionRe: What is Root in Garbage Collector(GC)? Pin
Paladin200028-Jun-10 9:37
Paladin200028-Jun-10 9:37 
AnswerRe: What is Root in Garbage Collector(GC)? Pin
riced28-Jun-10 9:48
riced28-Jun-10 9:48 

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.