bookcollection.cs

来自「OOP With Microsoft VB.NET And Csharp Ste」· CS 代码 · 共 44 行

CS
44
字号
using System;

namespace ABetterLibrary
{
	/// <summary>
	/// Summary description for BookCollection.
	/// </summary>
	public class BookCollection : System.Collections.DictionaryBase
	{
		public BookCollection()
		{
			//
			// TODO: Add constructor logic here
			//
		}

		public void Add(Book book)
		{
			this.Dictionary.Add(book.Title,book);
		}

		public void Remove(string title)
		{
			this.Dictionary.Remove(title);
		}

		public Book this [string title ] 
		{
			get 
			{
				if (this.Dictionary.Contains(title)) 
				{
					return (Book)(this.Dictionary [title ]);
				}
				else 
				{
					return null;
				}
			}
		}

	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?