Skip to content

Instantly share code, notes, and snippets.

@lallousx86
Created January 14, 2016 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lallousx86/7da235c28e777dec6615 to your computer and use it in GitHub Desktop.
Save lallousx86/7da235c28e777dec6615 to your computer and use it in GitHub Desktop.
C#/ListView extensions
public static class ListViewExtensions
{
public static string GetItemsString(
this System.Windows.Forms.ListViewItem lvi,
string SurroundL = "\"",
string SurroundR = "\"",
string Join = "\t")
{
List<string> s = new List<string>();
foreach (System.Windows.Forms.ListViewItem.ListViewSubItem CurSub in lvi.SubItems)
s.Add(string.Format("{0}{1}{2}", SurroundL, CurSub.Text, SurroundR));
return string.Join(Join, s);
}
public static void SelectAll(
this System.Windows.Forms.ListView lv)
{
lv.BeginUpdate();
foreach (System.Windows.Forms.ListViewItem lvi in lv.Items)
lvi.Selected = true;
lv.EndUpdate();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment