I am using C#. I have created a class which can be included in any c#.net project (desktop or web based), but I want that only 10 objects will be created in that application of my class. If object instances created more than 10 then it should give an error or simple will not work.
There can be two situations,
- I'll included myclass.cs file in any project or
- I'll bundle my class in a DLL and then include it in any application
In both situations it must through error if more than 10 instances of my class is created in the application.
This question was asked by my teacher, he told me to search for the answer on internet, I tried but no where found any solution for this problem, I haven't heard that we can limit objects?
Is it possible, if yes then how?
Thanks