Cannot apply indexing with [] to an expression of type 'System.Collections.Generic.IEnumerable<ANY_TYPE>
Solution:
If used of IEnumerable
- SampleArray[index] WRONG
- SampleArray.ElementAt(index) RIGHT
Because the IEnumerable
Amastaneh blog is a discussion site on software development, programming, algorithms, software architectures,software run-time errors and solutions from software engineers who love building great softwares.
BindingListCollectionView CurrentView = categoriesViewSource.View as BindingListCollectionView; Table tb1 = CurrentView.AddNew() as Table1; tb1.ID = Guid.NewGuid(); this.CurrentView.CommitNew();
TreeViewItem matchItam = SelectTreeViewItem(this.treeView1.Items, "sample value");
private TreeViewItem SelectTreeViewItem(ItemCollection Collection, String Value) { if (Collection == null) return null; foreach(TreeViewItem Item in Collection) { /// Find in current if (Item.Header.Equals(Value)) { Item.IsSelected = true; return Item; } /// Find in Childs if (Item.Items != null) { TreeViewItem childItem = this.SelectTreeViewItem(Item.Items, Value); if (childItem != null) { Item.IsExpanded = true; return childItem; } } } return null; }
/// Solution A html = Regex.Replace(html, @"\n|\t", " "); html = Regex.Replace(html, @">\s+<", "><").Trim(); html = Regex.Replace(html, @"\s{2,}", " "); /// Solution B html = Regex.Replace(html, @"(?<=[^])\t{2,}|(?<=[>])\s{2,}(?=[<])|(?<=[>])\s{2,11}(?=[<])|(?=[\n])\s{2,}", ""); html = Regex.Replace(html, @"[ \f\r\t\v]?([\n\xFE\xFF/{}[\];,<>*%&|^!~?:=])[\f\r\t\v]?", "$1"); html = html.Replace(";\n", ";"); /// Solution C html = Regex.Replace(html, @"[a-zA-Z]+#", "#"); html = Regex.Replace(html, @"[\n\r]+\s*", string.Empty); html = Regex.Replace(html, @"\s+", " "); html = Regex.Replace(html, @"\s?([:,;{}])\s?", "$1"); html = html.Replace(";}", "}"); html = Regex.Replace(html, @"([\s:]0)(px|pt|%|em)", "$1"); /// Remove comments html = Regex.Replace(html, @"/\*[\d\D]*?\*/", string.Empty);