Esempio n. 1
0
    ///<summary>
    ///	DEMO
    //
    //	REFERENCE: URL (http://msdn.microsoft.com/en-us/library/512aeb7t%28v=VS.80%29.aspx);
    ///</summary>
    private void _doDemoOfGenericClass()
    {
        // DECLARE 1
        ShotGenericClass <uint> uintShotGenericClass = new ShotGenericClass <uint> (1);       //TODO: I. Try to pass a float here. Compiler purposefully gives an error.

        // USE
        uintShotGenericClass.updateInternalStorage(42);          //TODO: II. Try to pass a float here. Compiler purposefully gives an error.
        Debug.Log("	uintShotGenericClass: " + uintShotGenericClass.millilitersDrank);

        // DECLARE 2
        ShotGenericClass <float> floatShotGenericClass = new ShotGenericClass <float> (1.1f);

        // USE
        floatShotGenericClass.updateInternalStorage(33.3f);
        Debug.Log("	floatShotGenericClass: " + floatShotGenericClass.millilitersDrank);
    }
    ///<summary>
    ///	DEMO
    //
    //    REFERENCE: URL (http://msdn.microsoft.com/en-us/library/512aeb7t%28v=VS.80%29.aspx);
    ///</summary>
    private void _doDemoOfGenericClass()
    {
        // DECLARE 1
        ShotGenericClass<uint> uintShotGenericClass = new ShotGenericClass<uint> (1); //TODO: I. Try to pass a float here. Compiler purposefully gives an error.

        // USE
        uintShotGenericClass.updateInternalStorage (42); //TODO: II. Try to pass a float here. Compiler purposefully gives an error.
        Debug.Log ("	uintShotGenericClass: " + uintShotGenericClass.millilitersDrank);

        // DECLARE 2
        ShotGenericClass<float> floatShotGenericClass = new ShotGenericClass<float> (1.1f);

        // USE
        floatShotGenericClass.updateInternalStorage (33.3f);
        Debug.Log ("	floatShotGenericClass: " + floatShotGenericClass.millilitersDrank);
    }