How can I write a class in C# that only returns the “same” instance of an object? Is this effectively a singleton or different? This was mentioned in the book Effective Java 2nd addition.
I use C# 4.0 (no technology barrier).
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, this is a Singleton pattern. You’ll find an excellent discussion based on our own Jon Skeet’s C# implementation here.