The singleton pattern can be used to delay the initialization of an object as long as possible.
单元素模式可以用来尽可能久地延迟对象的初始化。
To facilitate this, the plug-in class implements the singleton pattern: It stores a reference to itself in a private class variable.
为了使这一点更方便,插件类实现单模式(singleton pattern):它在私有类变量中存储一个自身的引用。
The singleton pattern is probably one of the most often used OOP design patterns; it restricts the number of object instances of a class to one.
单例模式可能是最常用的OOP设计模式之一了;它限制了一个类的对象实例数只能为1。
Since it is thread safe by design, you might cache it in a public static final variable, or wrap it in a singleton pattern after creation for later access.
因为根据设计它是线程安全的,创建它之后可以把它缓存在一个公共静态最终变量中,或者包装在单实例模式中以供以后访问。
The singleton pattern ensures that only a single instance of a class is normally used by an application, but still allows alternate instances to be created as required.
单元素模式可以确保应用程序通常只使用类的单个实例,但是仍然允许根据需要创建备用实例。
Unless the Settings wrapper class is designed using the singleton pattern, there can be multiple instances of the same application Settings class in a single application.
除非使用单一实例模式来设计设置包装类,否则单个应用程序中可能存在同一个应用程序设置类的多个实例。
Using C# 2.0 Generics to achieve a reusable Singleton pattern
使用 C# 2.0泛型来完成单例模式的重用
Doing so creates an instance of the Singleton Pattern in the Model Explorer.
执行此操作将会在模型浏览器中生成一个Singleton模式的实例。
Singleton Pattern Ensure a class has one instance, and provide a global point of access to it.
确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例。
To create an instance of the Factory Method Pattern, perform the same steps as for the Singleton Pattern.
要创建Factory方法模式的实例,执行同Singleton模式相同的步骤。
Classes implementing Singleton pattern will ensure that only one instance of the object ever exists at any one time.
使用类来实现单例模式可以确保在任何时间只有一个实例对象。
Most caches are implemented using the Singleton pattern involving a static reference to a top level cache class as shown in this example.
使用Singleton模式实现的大多数缓存都涉及本例所示的对顶级cache类的静态引用。
Typical examples include a cached DAO, cache of JNDI references, or any sort of common factory or other component that needs to use the Singleton pattern.
典型的例子有:缓存的DAO,JNDI引用的缓存,或者任何类型的公共工厂或者其他需要使用Singleton模式的组件。
Using the Singleton pattern we guarantee that no matter how many times the BusinessLayerProxy tries to create a CommandFactory, only one instance will exist.
使用Singleton模式,我们可以保证无论BusinessLayerProxy多少次尝试建立CommandFactory,也只存在一个实例。
The framework we'll create is a simple 3-tier framework that processes business logic using three patterns: the 3-layer architecture pattern, the Singleton pattern, and the Command pattern.
我们将要建立的是一个简单的3-tier框架,它使用了三种模式处理业务逻辑:3-layer体系结构模式、Singleton模式和Command模式。
The framework we'll create is a simple 3-tier framework that processes business logic using three patterns: the 3-layer architecture pattern, the Singleton pattern, and the Command pattern.
我们将要建立的是一个简单的3-tier框架,它使用了三种模式处理业务逻辑:3-layer体系结构模式、Singleton模式和Command模式。
应用推荐