Skip to content

Instantly share code, notes, and snippets.

@masaru-b-cl
Created August 22, 2012 01:49
Show Gist options
  • Save masaru-b-cl/3421373 to your computer and use it in GitHub Desktop.
Save masaru-b-cl/3421373 to your computer and use it in GitHub Desktop.
コレクション初期化子がコンパイルエラーにならない条件
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class MyCollection : IEnumerable
{
public void Add(string value)
{
}
}
class Program
{
static void Main(string[] args)
{
var col = new MyCollection { "1" };
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment