Skip to content

Instantly share code, notes, and snippets.

@azyobuzin
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azyobuzin/ec34df3971ed4177f29c to your computer and use it in GitHub Desktop.
Save azyobuzin/ec34df3971ed4177f29c to your computer and use it in GitHub Desktop.
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