コード例 #1
0
    /// <summary>
    /// Determines if the lecture list contains the lecture.
    /// </summary>
    /// <returns><c>true</c>, if lecture exists, <c>false</c> otherwise.</returns>
    /// <param name="l">L.</param>
    public bool ContainsLecture(Lecture l)
    {
        bool contains = false;

        for (int i=0; i<mLectures.Count; i++)
        {
            if(mLectures[i].GetID() == l.GetID())
            {
                contains =  true;
                break;
            }
        }

        return contains;
    }
コード例 #2
0
    /// <summary>
    /// Removes the lecture.
    /// </summary>
    /// <returns><c>true</c>, if lecture was removed, <c>false</c> otherwise.</returns>
    /// <param name="l">L.</param>
    public bool RemoveLecture(Lecture l)
    {
        bool removed;
        int startSize = mLectures.Count;

        for (int i=0; i<mLectures.Count; i++)
        {
            if(mLectures[i].GetID() == l.GetID())
            {
                mLectures.RemoveAt(i);
                break;
            }
        }

        if(mLectures.Count < startSize)
            removed = true;
        else
            removed =false;

        return removed;
    }