Convert VB property to C#

S

Sam

Hi All

I'm a c# newbie and I'm having trouble with "vb to c# conversion".
Basically, I have 2 properties which allow me to access elements of each
array (_osVert and _wsVert) of points. The below is what I have in vb. Would
some one help me out? I was thinking to use indexer method but both
properties have the same argument signature.

Regards,

Sam


Public Property OC(ByVal index As Integer) As Point

Get

Return (_osVert(index))

End Get

Set(ByVal value As Point)

_osVert(index) = value

End Set

End Property





Public Property WC(ByVal index As Integer) As Point

Get

Return (_wsVert(index))

End Get

Set(ByVal value As Point)

_wsVert(index) = value

End Set

End Property
 
T

Truong Hong Thi

In C#, a property does not accept parameter. Let's use GetOC and SetOC
methods instead.
 
J

Jon Skeet [C# MVP]

Sam said:
I'm a c# newbie and I'm having trouble with "vb to c# conversion".
Basically, I have 2 properties which allow me to access elements of each
array (_osVert and _wsVert) of points. The below is what I have in vb. Would
some one help me out? I was thinking to use indexer method but both
properties have the same argument signature.

<snip>

You could use an indexer for one of them if it's a natural indexer, and
use Get/Set methods for the other property. It's a bit of a pain that
C# doesn't provide named indexers, IMO, but you just have to live with
it...

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top