mardi 26 janvier 2016

Static Factory Class in C#

i want to create an object from my apiReader Class using an static inner class.

What did i do wrong?

I use the Factory Design-pattern. (Gang Of Four)

Hope you can help me.

   class apiReader
{
    public enum debug{
        Debug, NONdebug};
    private const string api = "Look i'm allive!";
    private string usrID;
    private string usrCH;
    private apiReader();

    public static class apiReaderBuilder
    {
        private apiReader apicCLC;
        apiReaderBuilder()
        {
            //QR SCANNER
            apicCLC = new apiReader();
        }
        [Obsolete("Only for Debug")]
        apiReaderBuilder(debug debe)
        {
            apicCLC = new apiReader();
            apicCLC.usrID = "SomeUserID";
            apicCLC.usrCH = "SomeUserChannel";
        }

        apiReaderBuilder(string usrCode, string Channel)
        {
            apicCLC = new apiReader();
            apicCLC.usrID = usrCode;
            apicCLC.usrCH = chor;
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire