Skip to content

Instantly share code, notes, and snippets.

@hiyorin
Last active November 11, 2015 17:50
Show Gist options
  • Save hiyorin/b8d3d8913f93e8d3a8cb to your computer and use it in GitHub Desktop.
Save hiyorin/b8d3d8913f93e8d3a8cb to your computer and use it in GitHub Desktop.
LINQでループカウンタをとる
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