Use Array.Empty

This commit is contained in:
Patrick Barron
2020-07-04 11:54:25 -04:00
parent 176f25fb98
commit 6d1b00da64
20 changed files with 33 additions and 27 deletions

View File

@@ -206,7 +206,7 @@ namespace MediaBrowser.Model.Dlna
}
}
return new MediaFormatProfile[] { };
return Array.Empty<MediaFormatProfile>();
}
private MediaFormatProfile ValueOf(string value)

View File

@@ -813,18 +813,18 @@ namespace MediaBrowser.Model.Dlna
{
var stream = TargetAudioStream;
string inputCodec = stream == null ? null : stream.Codec;
string inputCodec = stream?.Codec;
if (IsDirectStream)
{
return string.IsNullOrEmpty(inputCodec) ? new string[] { } : new[] { inputCodec };
return string.IsNullOrEmpty(inputCodec) ? Array.Empty<string>() : new[] { inputCodec };
}
foreach (string codec in AudioCodecs)
{
if (string.Equals(codec, inputCodec, StringComparison.OrdinalIgnoreCase))
{
return string.IsNullOrEmpty(codec) ? new string[] { } : new[] { codec };
return string.IsNullOrEmpty(codec) ? Array.Empty<string>() : new[] { codec };
}
}
@@ -838,18 +838,18 @@ namespace MediaBrowser.Model.Dlna
{
var stream = TargetVideoStream;
string inputCodec = stream == null ? null : stream.Codec;
string inputCodec = stream?.Codec;
if (IsDirectStream)
{
return string.IsNullOrEmpty(inputCodec) ? new string[] { } : new[] { inputCodec };
return string.IsNullOrEmpty(inputCodec) ? Array.Empty<string>() : new[] { inputCodec };
}
foreach (string codec in VideoCodecs)
{
if (string.Equals(codec, inputCodec, StringComparison.OrdinalIgnoreCase))
{
return string.IsNullOrEmpty(codec) ? new string[] { } : new[] { codec };
return string.IsNullOrEmpty(codec) ? Array.Empty<string>() : new[] { codec };
}
}

View File

@@ -1,6 +1,7 @@
#nullable disable
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Querying
@@ -54,7 +55,7 @@ namespace MediaBrowser.Model.Querying
public UpcomingEpisodesQuery()
{
EnableImageTypes = new ImageType[] { };
EnableImageTypes = Array.Empty<ImageType>();
}
}
}