nandin
nandin

Reputation: 2575

how to convert this constructor to C#?

Do not know how to convert Me.Base to C#

Imports Microsoft.VisualBasic  

Public Class ReplaceHTML  
    Inherits System.IO.Stream  

    Private Base As System.IO.Stream  

    Public Sub New(ByVal ResponseStream As System.IO.Stream)  
        If ResponseStream Is Nothing Then 
           Throw New ArgumentNullException("ResponseStream")  
        Me.Base = ResponseStream  
    End Sub  
End Class  

full code is here

thanks!

Upvotes: 3

Views: 2160

Answers (3)

Manatherin
Manatherin

Reputation: 4187

try using this.Base

this tells it to use the current instance of the class

Edit:

with your updated question i think it should look more like

public class ReplaceHTML : System.IO.Stream
{
    private System.IO.Stream Base;
    public ReplaceHTML(System.IO.Stream ResponseStream)
    {
        if (ResponseStream == null)
        {
            throw new ArgumentNullException("ResponseStream");
        }
        this.Base = ResponseStream;
    }
}

Upvotes: 6

Andrew Hare
Andrew Hare

Reputation: 351596

Try this:

public YourClass(System.IO.Stream ResponseStream)
{
    if (ResponseStream == null)
    {
        throw new ArgumentNullException("ResponseStream");
    }
    // the "this" is optional here but I left it to show
    // that it is the equivalent of VB's "Me"
    this.Base = ResponseStream;
}

Upvotes: 4

AD.Net
AD.Net

Reputation: 13399

this.Base

That should be Me.Base

Upvotes: 3

Related Questions