Trying to create a simple noddy example so that I can build my next project using fluent interfaces. I need to provide the user of my dll with an intuitive step by step way of building a class.
Question. I would like the user only to see Initialise when the first start then step1 then step2 and then end?How can I do it?
这是我的尝试 一旦你把"。" 你看到一切,然后他们隐藏。
class Program
{
static void Main(string[] args)
{
IEnd builder = new StepBuilder()
.Initialize()
.LoadStuff()
.Validate()
.End();
时 时
时 时
public class StepBuilder : IInitialize,
IStep1,
IStep2,
IStep3,
IEnd
{
public IStep1 Initialize()
{
return this;
时 时
public IStep2 LoadStuff()
{
return this; ;
时 时
public IStep3 Validate()
{
return this;
时 时
public IEnd End()
{
return this;
时 时
public bool Save()
{
return true;
时 时
时 时
public class Step
{
public string Name { get; set; 时 时
public string Category { get; set; 时 时
public decimal Price { get; set; 时 时
时 时
public interface IInitialize
{
IStep1 Initialize();
时 时
public interface IStep1
{
IStep2 LoadStuff();
时 时
public interface IStep2
{
IStep3 Validate ();
时 时
public interface IStep3
{
IEnd End();
时 时
public interface IEnd
{
bool Save();
时 时
时 时
关于逐步建立流利界面的建议或良好联系?