Last active
November 11, 2015 17:50
-
-
Save hiyorin/b8d3d8913f93e8d3a8cb to your computer and use it in GitHub Desktop.
LINQでループカウンタをとる
This file contains 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 UnityEngine; | |
using System.Collections.Generic; | |
using System.Linq; | |
public class Example : MonoBehaviour | |
{ | |
void Start () | |
{ | |
List<int> list = new List<int> { | |
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, | |
}; | |
foreach (var row in list.Select ((value, index) => new {value, index})) | |
{ | |
Debug.LogFormat ("index={0}, value={1}", row.index, row.value); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment