如何将此构造函数转换为C#?
不知道如何将如何将此构造函数转换为C#?,c#,vb.net,C#,Vb.net,不知道如何将Me.Base转换为C# 完整代码是 谢谢 尝试使用this.Base 这个告诉它使用类的当前实例 编辑: 有了你最新的问题,我觉得应该更像 public class ReplaceHTML : System.IO.Stream { private System.IO.Stream Base; public ReplaceHTML(System.IO.Stream ResponseStream) { if (ResponseStream ==
Me.Base
转换为C#
完整代码是
谢谢 尝试使用
this.Base
这个
告诉它使用类的当前实例
编辑:
有了你最新的问题,我觉得应该更像
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;
}
}
应该是我。请尝试以下方法:
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;
}
类的其余部分和父类是什么样子的?您确定Base不仅仅是一个属性吗?很抱歉,最后一行似乎是屈尊的,必须将其设置为30个字符编译错误:错误1“ReplaceTHtml”不包含“Base”的定义,并且找不到接受类型为“ReplaceTHtml”的第一个参数的扩展方法“Base”(您是否缺少using指令或程序集引用?)谢谢大家!基于[this article](),看起来base是一个属性。@Dean请看编辑的版本,顺便说一下,对于许多vb到c的转换非常有用,我刚刚尝试过,它似乎能够很好地转换您链接的完整代码
this.Base
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;
}