Singleton

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Untitly
{
   public class Singleton<T> where T :new()
    {
        private static object objInstance = null;
        public static T getInstance()
        {
            if (objInstance == null) objInstance = new T();
            return (T)objInstance;
        } 
       
    }
}

  

posted on 2012-08-08 13:53  sajiao  阅读(172)  评论(0编辑  收藏  举报

导航

街边网