Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Item definition error hep needed

3 réponses
Avatar
Alain Dafflon
When I try to define the property Item in Class1 which
contains also an Indexer, I get the compile message
error : Class1 already contains a definition for Item.

Can anybody explain this to me ?

Thank You
Alain

namespace ClassLibrary1
{
public abstract class Class1
{
public Class1()
{
//
// TODO: Add constructor logic here
//
}

public object Item
{
get
{
return null;
}
}

public abstract object this [int index]
{
get; set;
}


}
}

3 réponses

Avatar
RAVAILLE James
Hello,

If you want to delete this error, you must rename the name of the property
Item, like ItemObject, but don't keep 'Item'.

Enjoy !

Bye.
James RAVAILLE.

"Alain Dafflon" a écrit :

When I try to define the property Item in Class1 which
contains also an Indexer, I get the compile message
error : Class1 already contains a definition for Item.

Can anybody explain this to me ?

Thank You
Alain

namespace ClassLibrary1
{
public abstract class Class1
{
public Class1()
{
//
// TODO: Add constructor logic here
//
}

public object Item
{
get
{
return null;
}
}

public abstract object this [int index]
{
get; set;
}


}
}




Avatar
Thank you James, that's what I did.
But This is not normal and I would like to now why ?
Is it a bug ? From where does come this "Item" ?

Alain

-----Message d'origine-----
Hello,

If you want to delete this error, you must rename the


name of the property
Item, like ItemObject, but don't keep 'Item'.

Enjoy !

Bye.
James RAVAILLE.

"Alain Dafflon" a écrit :

When I try to define the property Item in Class1 which
contains also an Indexer, I get the compile message
error : Class1 already contains a definition for Item.

Can anybody explain this to me ?

Thank You
Alain

namespace ClassLibrary1
{
public abstract class Class1
{
public Class1()
{
//
// TODO: Add constructor logic here
//
}

public object Item
{
get
{
return null;
}
}

public abstract object this [int index]
{
get; set;
}


}
}




.



Avatar
RAVAILLE James
I don't know it too. Item should be a hide key word...

Bye.
James RAVAILLE From France.

"" a écrit :

Thank you James, that's what I did.
But This is not normal and I would like to now why ?
Is it a bug ? From where does come this "Item" ?

Alain

>-----Message d'origine-----
>Hello,
>
>If you want to delete this error, you must rename the
name of the property
>Item, like ItemObject, but don't keep 'Item'.
>
>Enjoy !
>
>Bye.
>James RAVAILLE.
>
>"Alain Dafflon" a écrit :
>
>> When I try to define the property Item in Class1 which
>> contains also an Indexer, I get the compile message
>> error : Class1 already contains a definition for Item.
>>
>> Can anybody explain this to me ?
>>
>> Thank You
>> Alain
>>
>> namespace ClassLibrary1
>> {
>> public abstract class Class1
>> {
>> public Class1()
>> {
>> //
>> // TODO: Add constructor logic here
>> //
>> }
>>
>> public object Item
>> {
>> get
>> {
>> return null;
>> }
>> }
>>
>> public abstract object this [int index]
>> {
>> get; set;
>> }
>>
>>
>> }
>> }
>>
>>
>.
>