factory design pattern

  • Thread starter csharpula csharp
  • Start date
C

csharpula csharp

Hello,
I am building multi platform application and I would like to ask are
there any links which would provide me code with factory design pattern
implementaion in c# for this?
Thanks!
 
M

Michael Nemtsev [MVP]

Hello csharpula,

see www.dofactory.com site, there are samples for the most common patters,
including your one

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


cc> Hello,
cc> I am building multi platform application and I would like to ask are
cc> there any links which would provide me code with factory design
cc> pattern
cc> implementaion in c# for this?
cc> Thanks!
cc>
cc>
 
S

sloan

As mentioned, dofactory.com can get you started.

There are free ones there, and at least you'll learn some lingo.

...

If you're a newbie, then the Head First book on Design Patterns is a good
resource.

Check ebay. I periodically check auctions for design patterns....sometimes
I can pick up a book for <$10.


I find design patterns need some time....and the more resources, the
merrier. It sometimes takes different authors giving different examples for
them to click.

Don't limit yourself to c#,...I have some good java design pattern books,
even though I've code about 3 lines of java in the last 5 years.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Do a search in google, you will find plenty of articles/examples about it
 
C

csharpula csharp

Hello,
I looked at the examples but I need somethign really simple. I got
mutual method in few classes (no inheritence) and I need that the main
class will activate the proper function according to file extention of
input. How to implement this? Thank u!
 
S

schneider

Not real sure what your trying to do but maybe somthing like below:


using System;

using System.Collections.Generic;

using System.Text;



public interface IFactoryExample {

object FactoryMethod();

}



public class Example2 : IFactoryExample {

#region IFactoryExample Members

public object FactoryMethod() {

//provide implementation

throw new Exception("The method or operation is not implemented.");

}

#endregion

}

//-------------------

using System;

using System.Collections.Generic;

using System.Text;


public abstract class AbstractClass {

public abstract object FactoryMethod();

}



public class Example : AbstractClass {

public override object FactoryMethod() {

//provide implementation

throw new Exception("The method or operation is not implemented.");

}


}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top