Last active
August 29, 2015 14:01
-
-
Save azyobuzin/ec34df3971ed4177f29c to your computer and use it in GitHub Desktop.
This file contains 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.Generic; | |
using System.Linq; | |
namespace CoreTweet.Core | |
{ | |
public interface ITwitterResponse | |
{ | |
RateLimit RateLimit { get; set; } | |
} | |
public class TwitterResponse<T> : ITwitterResponse | |
{ | |
public T Value { get; set; } | |
public RateLimit RateLimit { get; set; } | |
} | |
public class ListedResponse<T> : ITwitterResponse, IEnumerable<T> | |
#if NET45 | |
, IReadOnlyCollection<T> | |
#endif | |
{ | |
public ListedResponse(T[] collection, RateLimit rateLimit) | |
{ | |
this.innerArray = collection; | |
this.RateLimit = rateLimit; | |
} | |
private readonly T[] innerArray; | |
public RateLimit RateLimit { get; set; } | |
public int Count | |
{ | |
get | |
{ | |
return this.innerArray.Length; | |
} | |
} | |
public T this[int index] | |
{ | |
get | |
{ | |
return this.innerArray[index]; | |
} | |
} | |
public IEnumerator<T> GetEnumerator() | |
{ | |
return this.innerArray.AsEnumerable().GetEnumerator(); | |
} | |
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() | |
{ | |
return this.GetEnumerator(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment