Minor code tweaks

このコミットが含まれているのは:
Sergio Pedri committed 2021-01-05 20:40:18 +01:00
1 親 2b1e88fbd8
コミット e27547fb43
2ファイル変更
+35 -35

検索条件に一致するファイルはありません

-3
ファイルの表示
@@ -2,9 +2,6 @@
using System.Collections.Generic;
using ComputeSharp.Core.Extensions;
using ComputeSharp.Graphics.Extensions;
#if NETSTANDARD2_0
using ComputeSharp.System.Collections.Generic;
#endif
using TerraFX.Interop;
namespace ComputeSharp.Graphics.Commands.Interop
+35 -32
ファイルの表示
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
#if NETSTANDARD2_0
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -25,36 +26,6 @@ namespace ComputeSharp
}
}
namespace Collections.Generic
{
/// <summary>
/// Extensions for the <see cref="Queue{T}"/> type.
/// </summary>
internal static class QueueExtensions
{
/// <summary>
/// Removes the object at the beginning of the <see cref="Queue{T}"/> instance and copies it to the result parameter.
/// </summary>
/// <typeparam name="T">The type of values in the input <see cref="Queue{T}"/>.</typeparam>
/// <param name="queue">The input <see cref="Queue{T}"/>.</param>
/// <param name="result">The removed object.</param>
/// <returns>Whether or not the object was successfully removed.</returns>
public static bool TryDequeue<T>(this Queue<T> queue, out T? result)
{
if (queue.Count > 0)
{
result = queue.Dequeue();
return true;
}
result = default;
return false;
}
}
}
namespace Runtime.InteropServices
{
/// <summary>
@@ -120,3 +91,35 @@ namespace ComputeSharp
}
}
}
namespace System.Collections.Generic
{
/// <summary>
/// Extensions for the <see cref="Queue{T}"/> type.
/// </summary>
internal static class QueueExtensions
{
/// <summary>
/// Removes the object at the beginning of the <see cref="Queue{T}"/> instance and copies it to the result parameter.
/// </summary>
/// <typeparam name="T">The type of values in the input <see cref="Queue{T}"/>.</typeparam>
/// <param name="queue">The input <see cref="Queue{T}"/>.</param>
/// <param name="result">The removed object.</param>
/// <returns>Whether or not the object was successfully removed.</returns>
public static bool TryDequeue<T>(this Queue<T> queue, out T? result)
{
if (queue.Count > 0)
{
result = queue.Dequeue();
return true;
}
result = default;
return false;
}
}
}
#endif