コード例 #1
0
ファイル: Dictionary.cs プロジェクト: LinaB77/Junior
        /// <summary>
        /// метод интерфейса ICloneable, осуществляющий глубокое копирование
        /// </summary>
        /// <returns>копия объекта Dictionary</returns>
        public override object Clone()
        {
            СategoryBook categoryBook = new СategoryBook(this.Type?.NameСategory ?? "не задано", this.Type?.IndexCategory ?? 0);

            return(new Dictionary
            {
                Name = this.Name, Author = this.Author, NumberPages = this.NumberPages,
                YearPubl = this.YearPubl, Local = this.Local, Type = categoryBook
            });
        }
コード例 #2
0
ファイル: Dictionary.cs プロジェクト: LinaB77/Junior
 public Dictionary(string name, string author, int numberPages, int yearPubl, Location local, СategoryBook categoryBook)
     : base(name, author, numberPages, yearPubl, local)
 {
     Type = categoryBook ?? new СategoryBook("не задано", 0);
 }