Clothing.Find C# (CSharp) Method

Find() public static method

Retourne le Clothing correspondant. (En copie)
public static Find ( int id ) : Clothing,
id int
return Clothing,
    public static Clothing Find(int id)
    {
        foreach (Clothing cloth in Clothings)
        {
            if (cloth.id == id)
                if (cloth is Hair)
                    return new Hair((Hair)cloth);
                else if (cloth is Beard)
                    return new Beard((Beard)cloth);
                else if (cloth is Body)
                    return new Body((Body)cloth);
                else if (cloth is Pant)
                    return new Pant((Pant)cloth);
                else if (cloth is Gloves)
                    return new Gloves((Gloves)cloth);
                else if (cloth is Tshirt)
                    return new Tshirt((Tshirt)cloth);
                else if (cloth is Eyes)
                    return new Eyes((Eyes)cloth);
                else if (cloth is Hat)
                    return new Hat((Hat)cloth);
                else
                    return new Clothing(cloth);
        }
        throw new System.Exception("Clothing.Find : Clothing not find");
    }