I have read the concepts and practiced some examples on OOAD and Design Patterns. But when I was asked to implement the singleton pattern in a little bit different manner, I was unable to do it and failed to reach my goal. I think I need some more in-depth understanding of the basics and some real experience with the concepts.
Please suggest me some good books and mini projects for me to get hands on experience on OOAD and Design Patterns in C#. I have almost 9 months of time frame to retake the test.
I have done this for singleton. It's valid code. But i was asked to implement in such a way that, i should be able to create instance of DBConnection class only once. use that instance to get the Connection object. This is where, i have failed to implement singleton :(
class DBConnection
{
private Connection _conn = null;
static Connection GetConnection()
{
if(_conn ==null)
_conn = new Connection(...);
return _conn;
}
}