Questions tagged [indexer]

367 questions
18
votes
8 answers

C# Multiple Indexers

Is it possible to have something like the following: class C { public Foo Foos[int i] { ... } public Bar Bars[int i] { ... } } If not, then are what are some of the ways I can achieve this? I know I could…
smack0007
  • 11,016
  • 7
  • 41
  • 48
15
votes
3 answers

How to exclude files from Eclipse indexing (Static Code Analysis)?

I have a makefile project comprised of many source, header and other files, which I am trying to convert to an Eclipse "native" project. The problem that the Indexer reports errors and warning on files that exist in the directories but are excluded…
ysap
  • 7,723
  • 7
  • 59
  • 122
14
votes
3 answers

wpf bind to indexer

works fine. But is there a way to pass a variable as indexer key?
Marinko Babic
  • 151
  • 1
  • 4
14
votes
1 answer

Using an array's SetValue method vs. the [] indexers

I noticed that arrays have the SetValue method, which seems a little out of place when you could just use the indexers. Is there some special purpose for SetValue? The MSDN article didn't seem to say what SetValue was for, just how to use it. …
Thick_propheT
  • 1,003
  • 2
  • 10
  • 29
13
votes
3 answers

Eclipse has two C/C++ indexers (fast & full): what's the difference?

Eclipse CDT provides two indexers for C/C++ code (Preferences > C/C++ > Indexer). Does anybody know what the exact difference is between these two? The help file isn't exactly enlightening: "CDT supports the contribution of additional indexers,…
Rabarberski
  • 23,854
  • 21
  • 74
  • 96
13
votes
2 answers

Overload indexer to have foreach'able class

I tried to do something like this but this doesn't work: class Garage { private List cars = new List(); public Car this[int i] { get { return cars[i]; } } //... } …
nan
  • 19,595
  • 7
  • 48
  • 80
13
votes
11 answers

C# what is the point or benefit of an indexer?

Doing some code reading and stumbled upon this snippet that I haven't seen before: public SomeClass { public someInterface this[String strParameter] { get { return SomeInternalMethod(strParameter); } } } It looks like it is called…
Michael Gattuso
  • 13,020
  • 2
  • 25
  • 29
13
votes
1 answer

Poor C# optimizer performance?

I've just written a small example checking, how C#'s optimizer behaves in case of indexers. The example is simple - I just wrap an array in a class and try to fill its values: once directly and once by indexer (which internally accesses the data…
Spook
  • 25,318
  • 18
  • 90
  • 167
13
votes
5 answers

Eclipse CDT indexer - how to solve unresolved includes

I have a workspace with multiple projects, which all compile with no problems. However, some of the projects are giving a lot of warnings in the editor about unresolved symbols, due to unresolved includes. Most are headers from other projects in the…
jam
  • 3,640
  • 5
  • 34
  • 50
12
votes
6 answers

Google Code Search-like source code indexer and visualizer

I'm looking for a way to search through our subversion repository or just packaged source code. Are there any downloadable servers/tools like Google Code Search to index source code (preferable with support of version control systems like svn) and…
m_vitaly
  • 11,856
  • 5
  • 47
  • 63
12
votes
3 answers

Using Moq to set any by any key and value

At the end of the question: Using Moq to set indexers in C#, there was an issue that someone highlighted a problem that I am having as well. But they did not find a solution. Specifically, I'm trying to use the generic It.IsAny as the…
Digicoder
  • 1,835
  • 1
  • 12
  • 21
11
votes
3 answers

Any possibility to declare indexers in C# as an abstract member?

As the title states, I would like to declare an indexer object this[int index] in an abstract class as an abstract member. Is this possible in any way? Is it possible to declare this in an interface too?
Francesco Belladonna
  • 11,361
  • 12
  • 77
  • 147
11
votes
1 answer

Android: how to use SectionIndexer

I am trying to find a way to use SectionIndexer, instead of AlphabetIndexer. What I am interested to do is to have elements of a string arrays on the section headers instead of alphabets. I have not been able to find any sample code using section…
TJ1
  • 7,578
  • 19
  • 76
  • 119
11
votes
3 answers

What is the difference between reindexall() vs reindexeverything() in magento?

I would like to know what the difference is between reindexAll() and reindexEverything() in Magento indexer?
Bejoy
  • 311
  • 2
  • 5
11
votes
3 answers

How do I "go to definition" for the indexer `this[]` in Visual Studio

I work with a codebase where several classes implement an indexer: public double this[int i, int j] { get { return ...; } set { ...; } } When I stumble over code like foo[1,2] = 3 in visual Studio 2008, I frequently want to right-click /…
HugoRune
  • 13,157
  • 7
  • 69
  • 144
1
2
3
24 25