gpt4 book ai didi

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

转载 作者:IT王子 更新时间:2023-10-29 04:46:28 24 4
gpt4 key购买 nike

这是我在 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)));

下面是我使用 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\.]+</\1>", String.Empty).Remove(0, s(0).IndexOf("/style>")), "class=""\d+""", String.Empty), "[\d\.]+").Cast(Of Match)().[Select](Function(m) m.Value)) & ":" & s(1))
Next

我收到一条错误消息:

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

InlineAssingHelper 应该是什么?

最佳答案

添加这样的函数:

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

关于c# - 将 C# 转换为 VB.Net 时未声明“InlineAssignHelper”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14618464/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com