Skip to content

Instantly share code, notes, and snippets.

@masaru-b-cl
Created April 27, 2012 05:09
Show Gist options
  • Save masaru-b-cl/2506053 to your computer and use it in GitHub Desktop.
Save masaru-b-cl/2506053 to your computer and use it in GitHub Desktop.
RemoveAtじゃないけどIndex指定して抜いたコレクション取得
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var source = new[] { "a", "b", "c" };
foreach (var item in source
.Select((x,i) => new { Item=x, Index=i})
.Where(x => x.Index != 1)
.Select(x=>x.Item))
{
Console.WriteLine(item);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment