Remove custom ToArray extension

This commit is contained in:
Bond_009
2018-12-28 16:48:26 +01:00
parent a86b71899e
commit 6e5d2aadaa
59 changed files with 137 additions and 178 deletions

View File

@@ -101,7 +101,7 @@ namespace MediaBrowser.Model.Dlna
{
list.Add(MediaFormatProfile.MPEG_TS_JP_T);
}
return list.ToArray(list.Count);
return list.ToArray();
}
if (StringHelper.EqualsIgnoreCase(videoCodec, "h264"))
{

View File

@@ -186,7 +186,7 @@ namespace MediaBrowser.Model.Dlna
list.Add(string.Format("{0}={1}", pair.Name, encodedValue));
}
string queryString = string.Join("&", list.ToArray(list.Count));
string queryString = string.Join("&", list.ToArray());
return GetUrl(baseUrl, queryString);
}

View File

@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Collections.Generic;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Extensions;
@@ -104,7 +105,7 @@ namespace MediaBrowser.Model.Entities
attributes.Add("Default");
}
return string.Join(" ", attributes.ToArray(attributes.Count));
return string.Join(" ", attributes.ToArray());
}
if (Type == MediaStreamType.Video)
@@ -123,7 +124,7 @@ namespace MediaBrowser.Model.Entities
attributes.Add(Codec.ToUpper());
}
return string.Join(" ", attributes.ToArray(attributes.Count));
return string.Join(" ", attributes.ToArray());
}
if (Type == MediaStreamType.Subtitle)
@@ -154,7 +155,7 @@ namespace MediaBrowser.Model.Entities
attributes.Add("Forced");
}
string name = string.Join(" ", attributes.ToArray(attributes.Count));
string name = string.Join(" ", attributes.ToArray());
return name;
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
// TODO: @bond Remove
namespace MediaBrowser.Model.Extensions
{
// MoreLINQ - Extensions to LINQ to Objects
@@ -42,19 +43,6 @@ namespace MediaBrowser.Model.Extensions
return source.DistinctBy(keySelector, null);
}
public static TSource[] ToArray<TSource>(this IEnumerable<TSource> source, int count)
{
if (source == null) throw new ArgumentNullException("source");
if (count < 0) throw new ArgumentOutOfRangeException("count");
var array = new TSource[count];
int i = 0;
foreach (var item in source)
{
array[i++] = item;
}
return array;
}
/// <summary>
/// Returns all distinct elements of the given source, where "distinctness"
/// is determined via a projection and the specified comparer for the projected type.

View File

@@ -2,8 +2,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using MediaBrowser.Model.Services;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Services
{
@@ -586,7 +584,7 @@ namespace MediaBrowser.Model.Services
WriteCharBytes(bytes, ch, e);
}
byte[] buf = bytes.ToArray(bytes.Count);
byte[] buf = bytes.ToArray();
bytes = null;
return e.GetString(buf, 0, buf.Length);

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Services
{
@@ -221,7 +220,7 @@ namespace MediaBrowser.Model.Services
public override String ToString()
{
var vals = this.Select(GetQueryStringValue).ToArray(this.Count);
var vals = this.Select(GetQueryStringValue).ToArray();
return string.Join("&", vals);
}