Last active
November 16, 2015 06:28
-
-
Save ciniml/cb1e7a3748d9b8461ae4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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