如何在ASP.NET应用程序中编写单个类?我们可以制作monlton类的多个对象吗? [英] How to write an singlton class in ASP.NET application ? can we make multiple object of singlton class ?

查看:97
本文介绍了如何在ASP.NET应用程序中编写单个类?我们可以制作monlton类的多个对象吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 asp.net应用程序中编写单个  ?我们可以制作多个对象的singlton  class 





我的尝试:



不要尝试ccccccccccccccccccccccccc

解决方案

这闻起来像是一个功课问题。在你的家庭作业上寻求帮助没有什么不对,但你没有寻求帮助,你要求其他人做你的功课。不是一个好主意。



我建议你先做一些阅读,这将有助于在C#中实现Singleton [ ^ ]


请参阅实施C#中的单身人士 [ ^ ]。

请注意 Singleton 设计模式很容易扩展为允许多个实例(例如,参见 Multiton模式 - 维基百科,免费的百科全书 [ ^ ])。

how to write an singlton class in asp.net application ? can we make multiple object of singlton class ? 



What I have tried:

not trying ccccccccccccccccccccccccc

解决方案

This smells like a homework question. There is nothing wrong with asking for help on your homework but you are not asking for help, you are asking other people to do your homework. Not a good idea.

I suggest you start by doing some reading, this will help Implementing Singleton in C#[^]


See Implementing Singleton in C#[^].
Please note the Singleton design pattern is easily extended to allow multiple instances (see, for instance, the Multiton pattern - Wikipedia, the free encyclopedia[^]).


这篇关于如何在ASP.NET应用程序中编写单个类?我们可以制作monlton类的多个对象吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆