• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

new in C#


I am trying to learn C# from a VB background.
Normally in my classes I use a new sub to declare a new instance of the class objects. But when I try this in C# I run into all sorts of errors. Do you need to use the new sub in C# at all?
If you do, what would be the conversion for the code below?

Many thanks

Imports Obout.Grid
Imports System.Web.UI.WebControls

Public Class GridFactory

    Private GridFolderStyle As String

    Private Property _Grid As Grid

    Public Sub New()

        GridFolderStyle = ApplicationConfiguration.GridPath.ToString

        _Grid = New Grid()

    End Sub
1 Solution

import obout.Grid;
import System.Web.UI.WebControls;

public class GridFactory
      private String GridFolderStyle;
      private Grid _Grid;
      public void New()
            GridFolderStyle = ApplicationConfiguration.GridPath.ToString();
            _Grid = new Grid();
SolugaAuthor Commented:
Changed the import to using.
But great.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now