mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-04 00:34:26 -05:00 
			
		
		
		
	Added a .stock command
This commit is contained in:
		@@ -1,3 +1,5 @@
 | 
			
		||||
using System.Buffers;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Extensions;
 | 
			
		||||
 | 
			
		||||
// made for expressions because they almost never get added
 | 
			
		||||
@@ -29,4 +31,15 @@ public static class ArrayExtensions
 | 
			
		||||
    /// <returns>New array with updated elements</returns>
 | 
			
		||||
    public static TOut[] Map<TIn, TOut>(this TIn[] arr, Func<TIn, TOut> f)
 | 
			
		||||
        => Array.ConvertAll(arr, x => f(x));
 | 
			
		||||
 | 
			
		||||
    public static IReadOnlyCollection<TOut> Map<TIn, TOut>(this IReadOnlyCollection<TIn> col, Func<TIn, TOut> f)
 | 
			
		||||
    {
 | 
			
		||||
        var toReturn = new TOut[col.Count];
 | 
			
		||||
        
 | 
			
		||||
        var i = 0;
 | 
			
		||||
        foreach (var item in col)
 | 
			
		||||
            toReturn[i++] = f(item);
 | 
			
		||||
 | 
			
		||||
        return toReturn;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user