Created
April 27, 2012 05:09
-
-
Save masaru-b-cl/2506053 to your computer and use it in GitHub Desktop.
RemoveAtじゃないけどIndex指定して抜いたコレクション取得
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.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