将 C# 转换为 VB.Net 时未声明“InlineAssignHelper”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14618464/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 12:06:53  来源:igfitidea点击:

'InlineAssignHelper' is not declared When Converting C# To VB.Net

c#vb.netconverter

提问by user1992271

Here is my code in C#:

这是我在 C# 中的代码:

 ListBox l = new ListBox();
        foreach (string[] s in Regex.Matches(new WebClient().DownloadString("http://www.hidemyass.com/proxy-list/search-229092"), @"(?:<td class=""leftborder timestamp""(?s).+?<style>)((?s).+?)\s*<td>\s+(\d{2,5})</td>").Cast<Match>().Select(m => new string[] { m.Groups[1].Value, m.Groups[2].Value }))
        {
            Regex.Matches(s[0], @"\.([^\{]+)\{([^\}]+)\}").Cast<Match>().ToList().ForEach(m => s[0] = s[0].Replace(string.Format(@"class=""{0}""", m.Groups[1].Value), string.Format(@"style=""{0}""", m.Groups[2].Value)));

Now here is what codes out after I converted it using this:

现在这里是什么码出来后,我把它转换使用

     Dim l As New ListBox()
    For Each s As String() In Regex.Matches(New WebClient().DownloadString("http://www.hidemyass.com/proxy-list/search-229092"), "(?:<td class=""leftborder timestamp""(?s).+?<style>)((?s).+?)\s*<td>\s+(\d{2,5})</td>").Cast(Of Match)().[Select](Function(m) New String() {m.Groups(1).Value, m.Groups(2).Value})
        Regex.Matches(s(0), "\.([^\{]+)\{([^\}]+)\}").Cast(Of Match)().ToList().ForEach(Function(m) InlineAssignHelper(s(0), s(0).Replace(String.Format("class=""{0}""", m.Groups(1).Value), String.Format("style=""{0}""", m.Groups(2).Value))))
        l.Items.Add(String.Concat(Regex.Matches(Regex.Replace(Regex.Replace(s(0), "<(span|div) style=""display:none"">[\d\.]+</>", String.Empty).Remove(0, s(0).IndexOf("/style>")), "class=""\d+""", String.Empty), "[\d\.]+").Cast(Of Match)().[Select](Function(m) m.Value)) & ":" & s(1))
    Next

I am getting an error saying:

我收到一条错误消息:

Error   1   'InlineAssignHelper' is not declared. It may be inaccessible due to its protection level.

What should InlineAssingHelperbe?

应该InlineAssingHelper是什么?

回答by xpda

Add a function something like this:

添加一个类似这样的函数:

Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, ByVal value As T) As T
  target = value
  Return value
End Function