473,387 Members | 1,771 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,387 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 3168
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phil Stanton | last post by:
When designing a new form or report, the Default ForeColor is often something like -2147483640 which is the colour of Windows text (possibly black) and the default backColor is -2147483643...
1
by: Fritz Switzer | last post by:
With two controls a PictureBox and another "PictureBox like" , Pic2, a control from a dll, I'm stuck on cannot implicity convert System.Drawing.Image to System.Drawing.Bitmap error. How do I...
3
by: Tim Osborne | last post by:
I want to know if a call to Convert.Int32 can handle a Culture specific string. I have the following code: string sText = "111,111,111"; int i; i = Convert.Int32(...
3
by: David | last post by:
I need to covert DateTime Variables into a byte array but all of the conversion methods do not appear to handle the DateTime type. Is there a generic way to convert any property or object into a...
7
by: Scott Schluer | last post by:
Is there a way to use the Image class to convert a color photo (GIF or JPEG) to a B&W photo? Thanks, Scott
5
by: Mika M | last post by:
Hi! I've made little code to convert string into hex string... Public ReadOnly Property ToHexString(ByVal text As String) As String Get Dim arrBytes As Integer() = CharsToBytes(text) Dim sb...
3
by: QuocSi | last post by:
Hi all, I have a bitsfield Structure MyBits a as boolean b as boolean c as boolean d as boolean end structure
5
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public...
1
by: raghu1 | last post by:
How to convert a given date to its equvalent ticks.: string d="5/15/2006 12:10:44 PM"; // string 2 date ... dt=Convert.ToDateTime(d); // Date 2 ticks ... dt2ticks=dt.Ticks; string ticks =...
7
by: groups | last post by:
This is my first foray into writing a generic method and maybe I've bitten off more than I can chew. My intent is to have a generic method that accepts a value name and that value will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.