471,598 Members | 1,306 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Convert VB property to C#

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
Jan 3 '06 #1
2 3117
In C#, a property does not accept parameter. Let's use GetOC and SetOC
methods instead.

Jan 3 '06 #2
Sam wrote:
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

Jan 3 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Fritz Switzer | last post: by
3 posts views Thread by Tim Osborne | last post: by
3 posts views Thread by David | last post: by
7 posts views Thread by Scott Schluer | last post: by
5 posts views Thread by Mika M | last post: by
1 post views Thread by raghu1 | last post: by
2 posts views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

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.