Skip to content

Instantly share code, notes, and snippets.

@ghoti143
Created January 21, 2013 20:49
Show Gist options
  • Save ghoti143/4589219 to your computer and use it in GitHub Desktop.
Save ghoti143/4589219 to your computer and use it in GitHub Desktop.
list foreach
using System;
using JSIL;
using JSIL.Meta;
using System.Collections.Generic;
public static class Program {
public static void Main () {
var list = new List<long?>() { 1, 0, 3, null };
for (int i = 0; i < list.Count; i++)
{
if (list[i].HasValue && list[i].Value == 0)
{
list[i] = null;
}
}
foreach(var item in list)
{
Console.WriteLine(item);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment