Created
February 28, 2017 10:30
-
-
Save modesto/a6e1a1cbd86d07a100a27bec41fec442 to your computer and use it in GitHub Desktop.
Coding conventions sample 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Collections.Specialized; | |
using System.ComponentModel; | |
using System.Diagnostics; | |
using Microsoft.Win32; | |
namespace System.Collections.Generic | |
{ | |
public partial class ObservableLinkedList<T> : INotifyCollectionChanged, INotifyPropertyChanged | |
{ | |
private ObservableLinkedListNode<T> _head; | |
private int _count; | |
public ObservableLinkedList(IEnumerable<T> items) | |
{ | |
if (items == null) throw new ArgumentNullException(nameof(items)); | |
foreach (T item in items) | |
{ | |
AddLast(item); | |
} | |
} | |
public event NotifyCollectionChangedEventHandler CollectionChanged; | |
public int Count | |
{ | |
get { return _count; } | |
} | |
public ObservableLinkedListNode AddLast(T value) | |
{ | |
var newNode = new LinkedListNode<T>(this, value); | |
InsertNodeBefore(_head, node); | |
} | |
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e) | |
{ | |
NotifyCollectionChangedEventHandler handler = CollectionChanged; | |
if (handler != null) | |
{ | |
handler(this, e); | |
} | |
} | |
private void InsertNodeBefore(LinkedListNode<T> node, LinkedListNode<T> newNode) | |
{ | |
... | |
} | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment