Skip to content

Instantly share code, notes, and snippets.

@ciniml
Last active November 16, 2015 06:28
Show Gist options
  • Save ciniml/cb1e7a3748d9b8461ae4 to your computer and use it in GitHub Desktop.
Save ciniml/cb1e7a3748d9b8461ae4 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication17
{
class Program
{
static readonly ReadOnlyCollection<string> hoge = new []{"1", "2", "3"}.AsReadOnly();
static readonly ReadOnlyCollection<string> fuga = Array.AsReadOnly(new[] {"1", "2"});
static void Main(string[] args)
{
}
}
static class ArrayReadOnlyExtensions
{
public static ReadOnlyCollection<T> AsReadOnly<T>(this T[] array)
{
return Array.AsReadOnly(array);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment