How to assign class instances in exception handler during constructor execution

Posted by xwoundwortx on Stack Overflow See other posts from Stack Overflow or by xwoundwortx
Published on 2010-05-19T22:39:25Z Indexed on 2010/05/19 22:40 UTC
Read the original article Hit count: 130

Filed under:
|
    public Alphabet(params char[] list)
    {
        this.ExceptionInitializer();
        try
        {
            if (list != null) _alphabet = list;
            else throw this.NullableAssignment; //add exception handler;
            this._charCounter = list.Length;
        }
        catch (this.NullableAssignment)
        {
          //  var x = new Alphabet();   
          //  this = x;      //FAIL!
        }
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET