Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace ConsoleApp1
- {
- class Program
- {
- static byte []array=new byte [16];
- static Span<byte> getSpan ()
- {
- return new Span<byte> (array,4,8);
- }
- static void Main(string[] args)
- {
- Console.WriteLine ($"Start GC: {GC.CollectionCount(0)}");
- for (int i=0;i<10_000_000;i++)
- {
- getSpan();
- }
- Console.WriteLine ($"End GC: {GC.CollectionCount(0)}");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement