Skip to content

Commit

Permalink
Add Depth property
Browse files Browse the repository at this point in the history
  • Loading branch information
blowfishpro committed Aug 27, 2017
1 parent 038db23 commit 946194e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Collections/ImmutableStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ private ImmutableStack(T value, ImmutableStack<T> parent)
public bool IsRoot => parent == null;
public ImmutableStack<T> Root => IsRoot? this : parent.Root;

public int Depth => IsRoot ? 1 : parent.Depth + 1;

public ImmutableStack<T> Push(T newValue)
{
return new ImmutableStack<T>(newValue, this);
Expand Down

0 comments on commit 946194e

Please sign in to comment.