Global usings and file scoped namespaces

This commit is contained in:
Kwoth
2021-12-19 05:14:11 +01:00
parent bc31dae965
commit ee33313519
548 changed files with 47528 additions and 49115 deletions

View File

@@ -1,24 +1,21 @@
using System;
namespace NadekoBot.Extensions;
namespace NadekoBot.Extensions
// made for customreactions because they almost never get added
// and they get looped through constantly
public static class ArrayExtensions
{
// made for customreactions because they almost never get added
// and they get looped through constantly
public static class ArrayExtensions
/// <summary>
/// Create a new array from the old array + new element at the end
/// </summary>
/// <param name="input">Input array</param>
/// <param name="added">Item to add to the end of the output array</param>
/// <typeparam name="T">Type of the array</typeparam>
/// <returns>A new array with the new element at the end</returns>
public static T[] With<T>(this T[] input, T added)
{
/// <summary>
/// Create a new array from the old array + new element at the end
/// </summary>
/// <param name="input">Input array</param>
/// <param name="added">Item to add to the end of the output array</param>
/// <typeparam name="T">Type of the array</typeparam>
/// <returns>A new array with the new element at the end</returns>
public static T[] With<T>(this T[] input, T added)
{
var newCrs = new T[input.Length + 1];
Array.Copy(input, 0, newCrs, 0, input.Length);
newCrs[input.Length] = added;
return newCrs;
}
var newCrs = new T[input.Length + 1];
Array.Copy(input, 0, newCrs, 0, input.Length);
newCrs[input.Length] = added;
return newCrs;
}
}