コード例 #1
0
ファイル: Staff.cs プロジェクト: herkar95/Animal-Zoo-Project
        // Returns the staff object as a string, formatted accordingly.
        public override string ToString()
        {
            List <string> list      = m_qualifications.ToStringList();
            string        staffInfo = "(Staff) " + Name + " - ";

            for (int i = 0; i < list.Count; i++)
            {
                // Adds a comma if there are more qualifications to follow.
                if (i != (list.Count - 1))
                {
                    staffInfo += list[i] + ", ";
                }
                // Adds a dot if it's the last qualification.
                else
                {
                    staffInfo += list[i] + ".";
                }
            }
            return(staffInfo);
        }
コード例 #2
0
ファイル: Recipe.cs プロジェクト: ann-marieb/cs2018
        public override string ToString()
        {
            var ingredients = string.Join(", ", ingredientsList.ToStringList());

            return(RecipeName + ": " + ingredients + ".");
        }