Created
November 26, 2018 08:22
-
-
Save kyle-seongwoo-jun/371f2f55849daa1125d6b46bd226c3f0 to your computer and use it in GitHub Desktop.
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
namespace WinFormsUtil | |
{ | |
public static class ListViewUtils | |
{ | |
public static void SetSource<T>(this ListView.ListViewItemCollection items, IEnumerable<T> source, Func<T, ListViewItem> func) | |
{ | |
items.Clear(); | |
items.AddRange(source.Select(func).ToArray()); | |
} | |
public static void SetSource<T>(this ListView.ListViewItemCollection items, IEnumerable<T> source, Func<T, int, ListViewItem> func) | |
{ | |
items.Clear(); | |
items.AddRange(source.Select(func).ToArray()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment