using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using System.Runtime.Remoting.Messaging; using System.Runtime.Remoting.Proxies; using System.Text.RegularExpressions;
namespace WindowsApplication1 { /// <summary> /// ジェネリックなNullObjectを提供します。 /// プロキシの基本機能を提供するRealProxyを継承します。 /// </summary> /// <typeparam name="T"> /// NullObject対象の型を指定します。制約:publicなデフォルトコンストラクタを有するMarshalByRefObject型のクラスであること。 /// </typeparam> public class NullProxy<T> : RealProxy where T : MarshalByRefObject ,new() { /// <summary> /// ジェネリックなSingletonを提供するためのコレクション。 /// ガベコレで収集されるまでの間の弱い参照を保持します。 /// </summary> private static readonly Dictionary<Type, WeakReference> dicNullObject = new Dictionary<Type, WeakReference>();