VB Class Conversion Assistance Needed...

C

clintonG

VB
=====================

Public Interface IProcess
ReadOnly Property Title( ) As String
...
End Interface

Public Class ProcessBase Inherits System.Web.UI.UserControl Implements
IProcess

Sub New( )
MyBase.New( )
End Sub
...
End Class

C# Conversion
=====================
public interface IProcess
{
string Title
{ get; }
...
}

public class ProcessBase : System.Web.UI.UserControl, IProcess
{
ProcessBase( )
{
// System.Web.UI.UserControl does not contain a definition for 'New'
base.New( );
}

public virtual string Title
{
get { }
}
....
}

Question:
=====================
What is missing from this VB to C# conversion that will resolve compiler
errors?

For brevity I've only shown one data member "Title" of type string.
Clearly the VB 'New' keyword is not supported in C#. If I comment out
the entire C# ProcessBase( ) constructor and let C# create its own default
constructor the compiler still complains...

'MyNameSpace.ProcessBase.Title.get': 'not all code paths return a value

The C# was generated from converters [1],[2]. I hope somebody
may be able to explain how to resolve this issue. Thanks for comments...
 
D

David Anton

First of all... "Public Class ProcessBase Inherits ..." is not VB.
"Public Class ProcessBase : Inherits ..."
or
"Public Class ProcessBase
Inherits ..."
is VB

Anyway - after correcting the inherits part, I get the following from
our Instant C# VB.NET to C# converter:

public interface IProcess
{
string Title {get;}
...
}

public class ProcessBase : System.Web.UI.UserControl, IProcess
{

public ProcessBase() : base()
{
}
...
}

Please download our Demo Edition converter - all the questions I've
answered over the last couple of weeks are easily obtained via the
free Demo Edition.

http://www.instantcsharp.com

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
C

clintonG

I downloaded the demo. It seems to be smarter than the online converters
I've been trying to use. Thanks for nagging me ;-)

<%= Clinton Gallagher
 
D

David Anton

No problem - feel free to contact us (at
(e-mail address removed)) if you have any questions
about the conversion that Instant C# is producing.

The reason our quality is so good is that we take all the feedback we
get very seriously, even from users of our free Demo Edition.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top