⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 implementations.cs

📁 .NET 2.0模式开发实战源代码,使用C#说明
💻 CS
字号:
using System;using com.devspace.commons.Tracer;using Console = Chap03MockObjects.Console;namespace Chap03 {    public interface Intention {        void Echo( string message);    }    internal class Implementation : Intention {        public void Echo(string message) {            Console.WriteLine( "From the console " + message);        }    }    public class Factory {        public static Intention Instantiate() {            return new Implementation();        }    }    public interface IMathematics< numbertype> {        numbertype Add( numbertype param1, numbertype param2);    }    internal class IntMathematicsImpl : IMathematics< int> {        public int Add(int param1, int param2) {            checked {                return param1 + param2;            }        }    }    internal class IntMathematicsImpl2< basetype> : IMathematics< basetype> {        public basetype Add( basetype param1, basetype param2) {            checked {                return param1 + param2;            }        }    }    public class FactoryIMathematics {        public static IMathematics< int> Instantiate() {            return new IntMathematicsImpl();        }    }    public class FactoryIMathematics2< basetype> {        public static IMathematics< basetype> Instantiate() {            return new IntMathematicsImpl2< basetype>();        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -