Add override BitSet.ToString

This commit is contained in:
Sam Harwell 2013-02-23 23:10:23 -06:00
parent fdb73a92b8
commit 7d7f5a1afc
1 changed files with 17 additions and 0 deletions

View File

@ -280,5 +280,22 @@ namespace Sharpen
return result.GetHashCode();
}
public override string ToString()
{
StringBuilder builder = new StringBuilder();
builder.Append('{');
for (int i = NextSetBit(0); i >= 0; i = NextSetBit(i + 1))
{
if (builder.Length > 1)
builder.Append(", ");
builder.Append(i);
}
builder.Append('}');
return builder.ToString();
}
}
}