473,320 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

class with indexer is not accessible to other language

Hello,

I have a class with an indexer in the class. The code code is in C#.
However I was trying to access the indexer in the other lang of .Net,
VB. I ran into some indexer related issues (I believe they are because
of indexer)

Does any one can give me procedure to do the above?

-Cnu
Sep 27 '08 #1
3 1229
"Duggi" <Du***************@gmail.comwrote in message
news:04**********************************@s9g2000p rg.googlegroups.com...
I have a class with an indexer in the class. The code code is in C#.
However I was trying to access the indexer in the other lang of .Net,
VB. I ran into some indexer related issues (I believe they are because
of indexer)

Does any one can give me procedure to do the above?

When you define an indexer in C#, it is accessed from VB.Net as "Item".
For instance:

[C#]

class Whatever
{
public string this[int p]
{
get { ...; }
}
}
....
Whatever x = new Whatever();
string result = x[7];
[VB]

Dim x as New Whatever()
Dim result as String = x.Item(7)
Sep 27 '08 #2
On Sep 27, 1:10*pm, "Alberto Poblacion" <earthling-
quitaestoparacontes...@poblacion.orgwrote:
"Duggi" <DuggiSrinivasa...@gmail.comwrote in message

news:04**********************************@s9g2000p rg.googlegroups.com...
I have a class with an indexer in the class. The code code is in C#.
However I was trying to access the indexer in the other lang of .Net,
VB. I ran into some indexer related issues (I believe they are because
of indexer)
Does any one can give me procedure to do the above?

* * When you define an indexer in C#, it is accessed from VB.Net as "Item".
For instance:

[C#]

class Whatever
{
* *public string this[int p]
* *{
* * * get { ...; }
* *}}

...
Whatever x = new Whatever();
string result = x[7];

[VB]

Dim x as New Whatever()
Dim result as String = x.Item(7)
Thanks dude!!

its working.

-Cnu
Sep 28 '08 #3
On Sep 28, 12:10*am, "Alberto Poblacion" <earthling-
quitaestoparacontes...@poblacion.orgwrote:
"Duggi" <DuggiSrinivasa...@gmail.comwrote in message

news:04**********************************@s9g2000p rg.googlegroups.com...
I have a class with an indexer in the class. The code code is in C#.
However I was trying to access the indexer in the other lang of .Net,
VB. I ran into some indexer related issues (I believe they are because
of indexer)
Does any one can give me procedure to do the above?

* * When you define an indexer in C#, it is accessed from VB.Net as "Item".
For instance:

[C#]

class Whatever
{
* *public string this[int p]
* *{
* * * get { ...; }
* *}}

...
Whatever x = new Whatever();
string result = x[7];

[VB]

Dim x as New Whatever()
Dim result as String = x.Item(7)
Actually, you should be able to just use x(7) as well.
Sep 29 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: vijay | last post by:
Hello I wanted to understand a contradictory design of C++ class A {public: virtual void f(){ cout<<" base f"<<endl; } }; class B:public A {
16
by: Yoramo | last post by:
Hello I have a class the containes several ArrayList's and I whold like to use a indexer for each one. I'm getting a compilation error. "already defines a member called 'this' with the same...
21
by: Mark Broadbent | last post by:
Consider the following statements //------- Item i = Basket.Items; //indexer is used to return instance of class Item Basket.Items.Remove(); //method on class item is fired item i = new...
29
by: Michael D. Ober | last post by:
Is there any way to create a constant in a class that can be used both with an instantiated object and without. For example: dim ClassConst as string = myClass.ConstantString dim myObj = new...
17
by: RSH | last post by:
I am really trying to grasp the concept of OOP as it applies to C#. I am looking at trying to set up a simple Employee Class but I am having trouble conceptualizing what this class should look...
5
by: Clive Dixon | last post by:
Is it possible to access an indexer of a base class with identical signature, e.g. class Class1 { public object this { get { // ...
37
by: JohnGoogle | last post by:
Hi, Newbie question... After a recent article in VSJ I had a go at implementing a Fraction class to aid my understanding of operator overloading. After a previous message someone suggested...
12
by: titan nyquist | last post by:
I have a class with data and methods that use it. Everything is contained perfectly THE PROBLEM: A separate thread has to call a method in the current instantiation of this class. There is...
20
by: tshad | last post by:
Using VS 2003, I am trying to take a class that I created to create new variable types to handle nulls and track changes to standard variable types. This is for use with database variables. This...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.