CSharp · Console
using System;
using System.Collections.Generic;
namespace testread
{
internal static class Program
{
static void Main(string[] args)
{
var input1 = new[] { 1, 2 };
Foo(input1);
var input2 = new List<int> { 3, 4, 5 };
Foo(input2);
}
private static void Foo(IReadOnlyCollection<int> bar)
{
Console.WriteLine(bar.Count);
}
}
}