Download YamlDotNetTypeConverterPart2.zip, last updated 24/04/2017 (28.19 KB)

Download
  • md5: 77842736a3da9b0ae928274edd184779
  • sha1: b503ddbbe501df282116dbf9a83cb83de370177f
  • sha256: 67dfe4c342abf5f7ff82a0077e752dfce66ace5fee9aa7d6aca7698e19ea9f2a
using System.Collections.ObjectModel;

// Using custom type converters with C# and YamlDotNet, part 1
// http://www.cyotek.com/blog/using-custom-type-converters-with-csharp-and-yamldotnet-part-1

// This work is licensed under the Creative Commons Attribution 4.0 International License.
// To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.

namespace YamlDotNetTypeConverter
{
  internal sealed class ContentCategoryCollection : Collection<ContentCategory>
  {
    #region Fields

    private ContentCategory _parent;

    #endregion

    #region Properties

    public ContentCategory Parent
    {
      get { return _parent; }
      set
      {
        _parent = value;

        foreach (ContentCategory item in this)
        {
          item.Parent = value;
        }
      }
    }

    #endregion

    #region Methods

    protected override void InsertItem(int index, ContentCategory item)
    {
      item.Parent = _parent;

      base.InsertItem(index, item);
    }

    #endregion
  }
}

Donate

Donate