Solved

Convert the following to from VB .NET to C#

Posted on 2009-07-11
2
189 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

726 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