Solved

Convert the following to from VB .NET to C#

Posted on 2009-07-11
2
187 Views
Last Modified: 2012-05-07
I need to convert the following to C#.

Public Structure PageCrumb

   Private _level As Short
   Private _url As String
   Private _linkName As String

   //We are setting all the properties at the time of construction

   Public Sub New(ByVal level As Short, ByVal url As String,
          ByVal linkName As String)

      _level = level
      _url = url
      _linkName = linkName
   End Sub

   //We are making all the properties as read-only.
   //We are not expecting it to change once it is set.
   Public ReadOnly Property Level() As Short
   Get
      Return _level
   End Get
   End Property

   Public ReadOnly Property Url() As String
   Get
      Return _url
   End Get
   End Property

   Public ReadOnly Property LinkName() As String
   Get
      Return _linkName
   End Get
   End Property
End Structure
0
Comment
Question by:mathieu_cupryk
2 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 24833136
Online conversion tool for reference:
http://www.developerfusion.com/tools/convert/vb-to-csharp/

There are few more you can just google.
public struct PageCrumb
{
    
    private short _level;
    private string _url;
    private string _linkName;
    
    //We are setting all the properties at the time of construction
    
    public PageCrumb(short level, string url, string linkName)
    {
        
        _level = level;
        _url = url;
        _linkName = LinkName;
    }
    
    //We are making all the properties as read-only.
    //We are not expecting it to change once it is set.
    public short Level {
        get { return _level; }
    }
    
    public string Url {
        get { return _url; }
    }
    
    public string LinkName {
        get { return _linkName; }
    }
}

Open in new window

0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 24833161
Hi mathieu_cupryk;

Here you go.

public struct PageCrumb
{
    private short _level;
    private string _url;
    private string _linkName;

    public PageCrumb(short level, string url, string linkName)
    {
        _level = level;
        _url = url;
        _linkName = linkName;
    }

    public short Level
    {
        get { return _level; }
    }

    public string Url
    {
        get { return _url; }
    }

    public string LinkName
    {
        get { return _linkName; }
    }
}


Fernando
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question