Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryorah <yoram.harmelin@gmail.com>2012-11-21 21:09:29 +0400
committeryorah <yoram.harmelin@gmail.com>2012-11-23 15:51:51 +0400
commit1a45367cbd4013b8aa224956b47c8257ca370684 (patch)
tree53a577a9e933406920d9ffd3bcb5f0776eb02e8e /LibGit2Sharp/Index.cs
parent247ca1a30cfb722b74ada4288bcca7293f59b87b (diff)
Add some `DebuggerDisplay` love
I followed implementation best practices as described at http://blogs.msdn.com/b/jaredpar/archive/2011/03/18/debuggerdisplay-attribute-best-practices.aspx Also added a Meta test to make sure the same implementation is used everywhere when using `[DebuggerDisplay]`.
Diffstat (limited to 'LibGit2Sharp/Index.cs')
-rw-r--r--LibGit2Sharp/Index.cs7
1 files changed, 7 insertions, 0 deletions
diff --git a/LibGit2Sharp/Index.cs b/LibGit2Sharp/Index.cs
index 9cdbbd95..8a9f8d4d 100644
--- a/LibGit2Sharp/Index.cs
+++ b/LibGit2Sharp/Index.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
@@ -14,6 +15,7 @@ namespace LibGit2Sharp
/// The Index is a staging area between the Working directory and the Repository.
/// It's used to prepare and aggregate the changes that will be part of the next commit.
/// </summary>
+ [DebuggerDisplay("{DebuggerDisplay,nq}")]
public class Index : IEnumerable<IndexEntry>
{
private readonly IndexSafeHandle handle;
@@ -499,5 +501,10 @@ namespace LibGit2Sharp
Proxy.git_index_add(handle, indexEntry);
Marshal.FreeHGlobal(indexEntry.Path);
}
+
+ private string DebuggerDisplay
+ {
+ get { return string.Format("Count = {0}", Count); }
+ }
}
}