"murali@pune" <mu***********@gmail.com> a écrit dans le message de news:
11*********************@j33g2000cwa.googlegroups.c om...
| I want to create a class in C# that will only have 'n' instances at any
| given time. If (n+1)th instance is requested, an Exception will be
| thrown. These instances must be maintained in a collection in the
| class. Note that once an instance is acquired, it can be released as
| well.
Make the default constructor private and add a static method that will
control and return a number of instances; use a static field to keep track
of the count. You may have difficulty keeping track of instances being freed
as garbage collection is non-deterministic and can be difficult to track.
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer