Created
January 14, 2016 20:33
-
-
Save lallousx86/7da235c28e777dec6615 to your computer and use it in GitHub Desktop.
C#/ListView extensions
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
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