Skip to content

Commit

Permalink
Use IReadOnlyList instead of IReadOnlyCollection or IEnumerable
Browse files Browse the repository at this point in the history
  • Loading branch information
haacked committed Jan 4, 2015
1 parent 60373ea commit 5ec1d51
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Octokit.Tests/Helpers/AssertEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void IsReadOnlyCollection<T>(object instance) where T : class
{
var collection = instance as ICollection<T>;
// The collection == null case is for .NET 4.0
Assert.True(instance is IReadOnlyCollection<T> && (collection == null || collection.IsReadOnly));
Assert.True(instance is IReadOnlyList<T> && (collection == null || collection.IsReadOnly));
}
}
}
2 changes: 1 addition & 1 deletion Octokit/Models/Request/BaseSearchRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private string SortOrder
/// <summary>
/// All qualifiers that are used for this search
/// </summary>
public abstract IReadOnlyCollection<string> MergedQualifiers();
public abstract IReadOnlyList<string> MergedQualifiers();

/// <summary>
/// Add qualifiers onto the search term
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Request/SearchCodeRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public IEnumerable<CodeInQualifier> In
public string Repo { get; set; }

[SuppressMessage("Microsoft.Globalization", "CA1304:SpecifyCultureInfo", MessageId = "System.String.ToLower")]
public override IReadOnlyCollection<string> MergedQualifiers()
public override IReadOnlyList<string> MergedQualifiers()
{
var parameters = new List<string>();

Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Request/SearchIssuesRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public IEnumerable<string> Labels
/// </remarks>
public string Repo { get; set; }

public override IReadOnlyCollection<string> MergedQualifiers()
public override IReadOnlyList<string> MergedQualifiers()
{
var parameters = new List<string>();

Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Request/SearchRepositoriesRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public IEnumerable<InQualifier> In
/// </summary>
public DateRange Updated { get; set; }

public override IReadOnlyCollection<string> MergedQualifiers()
public override IReadOnlyList<string> MergedQualifiers()
{
var parameters = new List<string>();

Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Request/SearchUsersRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public IEnumerable<UserInQualifier> In
}
}

public override IReadOnlyCollection<string> MergedQualifiers()
public override IReadOnlyList<string> MergedQualifiers()
{
var parameters = new List<string>();

Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Response/CompareResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class CompareResult
public int AheadBy { get; protected set; }
public int BehindBy { get; protected set; }
public int TotalCommits { get; protected set; }
public IReadOnlyCollection<GitHubCommit> Commits { get; protected set; }
public IReadOnlyList<GitHubCommit> Commits { get; protected set; }

internal string DebuggerDisplay
{
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Response/Contributor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class Contributor

public int Total { get; protected set; }

public IEnumerable<WeeklyHash> Weeks { get; protected set; }
public IReadOnlyList<WeeklyHash> Weeks { get; protected set; }

internal string DebuggerDisplay
{
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Response/Issue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class Issue
/// <summary>
/// The set of labels applied to the issue
/// </summary>
public IReadOnlyCollection<Label> Labels { get; protected set; }
public IReadOnlyList<Label> Labels { get; protected set; }

/// <summary>
/// The user this issue is assigned to.
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Response/OauthToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class OauthToken
/// <summary>
/// The list of scopes the token includes.
/// </summary>
public IReadOnlyCollection<string> Scope { get; set; }
public IReadOnlyList<string> Scope { get; set; }

internal string DebuggerDisplay
{
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Response/PunchCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public PunchCard(IEnumerable<IList<int>> punchCardData)
/// <summary>
/// The raw punch card points
/// </summary>
public IReadOnlyCollection<PunchCardPoint> PunchPoints { get; private set; }
public IReadOnlyList<PunchCardPoint> PunchPoints { get; private set; }

/// <summary>
/// Gets the number of commits made on the specified day of the week
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Response/TreeResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class TreeResponse
/// <summary>
/// The list of Tree Items for this Tree response.
/// </summary>
public IReadOnlyCollection<TreeItem> Tree { get; protected set; }
public IReadOnlyList<TreeItem> Tree { get; protected set; }

internal string DebuggerDisplay
{
Expand Down
4 changes: 2 additions & 2 deletions Octokit/SimpleJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// NOTE: uncomment the following line to enable DataContract support.
//#define SIMPLE_JSON_DATACONTRACT

// NOTE: uncomment the following line to enable IReadOnlyCollection<T> and IReadOnlyList<T> support.
// NOTE: uncomment the following line to enable IReadOnlyList<T> and IReadOnlyList<T> support.
//#define SIMPLE_JSON_READONLY_COLLECTIONS

// NOTE: uncomment the following line to disable linq expressions/compiled lambda (better performance) instead of method.invoke().
Expand Down Expand Up @@ -1717,7 +1717,7 @@ public static bool IsTypeGenericeCollectionInterface(Type type)
|| genericDefinition == typeof(ICollection<>)
|| genericDefinition == typeof(IEnumerable<>)
#if SIMPLE_JSON_READONLY_COLLECTIONS
|| genericDefinition == typeof(IReadOnlyCollection<>)
|| genericDefinition == typeof(IReadOnlyList<>)

This comment has been minimized.

Copy link
@khellang

khellang Jan 4, 2015

Contributor

I guess this slipped in unintentionally?

This comment has been minimized.

Copy link
@haacked

haacked Jan 4, 2015

Author Contributor

Doh! Search and replace fail!

|| genericDefinition == typeof(IReadOnlyList<>)
#endif
);
Expand Down

0 comments on commit 5ec1d51

Please sign in to comment.