Questions tagged [indexer]

367 questions
10
votes
6 answers

C# extend indexer?

Is it possible to use extension methods to extend an indexer? I want to be able to get cell's value from DataGridViewCell of given DataGridViewRow using header text like this: object o = row["HeaderText"]; I have this code public static class…
Blablablaster
  • 3,238
  • 3
  • 31
  • 33
10
votes
2 answers

Generic Swap difficulty

I'm coming from C++ where it's easy to do something like this: template void Swap(T &a, T &b) { T temp = a; a = b; b = temp; } and then use it to swap values in a container: std::vector
mat
  • 101
  • 1
  • 3
10
votes
2 answers

How to get Index of an Item in ICollection

I have this list of cars ICollection Cars and I also have a single car object, which I know is in the ICollection how do I get the index/position of the car in the list? I need to add it to a list of strings This is what I have so far: var…
Ayo Adesina
  • 2,231
  • 3
  • 37
  • 71
9
votes
1 answer

Why Blocks are Missing or Skipped on NEAR

I was wondering how come some blocks exist but some don't? It seems like they get skipped and I'm unsure as to why. For example: 87868936 exists and so does 87868938 but 87868938 does not. Thanks!
Benjamin Kurrek
  • 1,044
  • 3
  • 14
9
votes
1 answer

What is the meaning of `public string this[string columnName]` When implementing IDataErrorInfo interface?

What is the meaning of public string this[string columnName] When implementing IDataErrorInfo interface? public string this[string columnName] { get { switch (columnName) { case…
Saeid
  • 691
  • 7
  • 26
9
votes
2 answers

What the difference between array indexer and any other object indexer

Consider following two data types: class C { public int I { get; set; } } struct S { public int I { get; set; } } Let's try to use them inside the list, for example: var c_list = new List { new C { I = 1 } }; c_list[0].I++; var s_list…
lorond
  • 3,856
  • 2
  • 37
  • 52
8
votes
4 answers

Magento Catalog URL rewrites stuck on processing

As the title says my Catalog URL rewrites indexer is stuck on processing. I've tried everything and I just can't find a solution to this. Does anyone know a solid fix for this? I've tried truncating core_url_rewrite table and deleting the locks but…
sulman
  • 2,431
  • 7
  • 40
  • 62
8
votes
2 answers

C++11 settings in Eclipse Indexer conflict with git

In order to set up C++11 for specific projects, I'm required to add -std=c++11 to the CDT GCC Built-in Compiler Settings under Project -> Properties -> C/C++ General -> Preprocessor Include Paths, Macros etc. This creates a file called…
Shloim
  • 5,281
  • 21
  • 36
8
votes
3 answers

“Strange” C# property syntax

I just saw this in a c# project: public char this[int index] I consider myself new to C#; any one can help what it's meaning?
user522745
  • 161
  • 1
  • 2
  • 7
7
votes
4 answers

Create Indexer in VB.NET which can be used from C#

Can I create a class in VB.NET which can be used from C# like that: myObject.Objects[index].Prop = 1234; Sure I could create a property which returns an array. But the requirement is that the index is 1-based, not 0-based, so this method has to map…
codymanix
  • 28,510
  • 21
  • 92
  • 151
7
votes
1 answer

Implementing Indexer in F#

I am trying to convert this C# code to F#: double[,] matrix; public Matrix(int rows, int cols) { this.matrix = new double[rows, cols]; } public double this[int row, int col] { get { return…
Beaker
  • 2,804
  • 5
  • 33
  • 54
7
votes
1 answer

Is there a built-in generic interface with covariant type parameter returned by an indexer?

In this thread How to get null instead of the KeyNotFoundException accessing Dictionary value by key? in my own answer I used explicit interface implementation to change the basic dictionary indexer behaviour not to throw KeyNotFoundException if the…
horgh
  • 17,918
  • 22
  • 68
  • 123
7
votes
3 answers

Indexer as part of the interface in C#

In C#, what's the syntax for declaring an indexer as part of an interface? Is it still this[ ]? Something feels odd about using the this keyword in an interface.
Dinah
  • 52,922
  • 30
  • 133
  • 149
7
votes
3 answers

Eclipse 3.7 cannot resolve Types in C++ Editor

I recently changed from Eclipse 3.6 to Eclipse 3.7 , which I am using for C++ development in Ubuntu 11.04 . With Version 3.6 I had no big troubles, except that I always had some issues with the indexer. Now with Version 3.7 it begins marking…
Toby
  • 3,815
  • 14
  • 51
  • 67
6
votes
2 answers

XML Comments - How do you reference a dictionary indexer properly?

As the name states, I have no idea how to reference a dictionary indexer. Any help here? :) FYI, I've tried: //Highly doubted this would work.
myermian
  • 31,823
  • 24
  • 123
  • 215
1 2
3
24 25