小编gip*_*ipo的帖子

正则表达式获取文本后锚标记C#

我有一个C#Regex如下:

Regex r = new Regex(@"(?<value1>.*?)<a.*?href=(""|')(?<href>.*?)(""|').*?>(?<value2>.*?)</a>(?<value3>.*?)");
Run Code Online (Sandbox Code Playgroud)

我可以获得value1,href,value2完美的文本.但是,value3始终为"".

在锚结束标记()之后得到的文本我缺少什么.

c# regex anchor

0
推荐指数
1
解决办法
767
查看次数

在线程之间切换

我有两个主题:

static Thread thread1 = new Thread(new ThreadStart(Team1Shots));
static Thread thread2 = new Thread(new ThreadStart(Team2Shots));
Run Code Online (Sandbox Code Playgroud)

我希望thread1做一些工作(但不完整),然后thread2做一些工作(但不完整),然后回去完成thread1,然后回去完成thread2.

到目前为止我有这个:

static void Main(string[] args)
{
    thread1.Start();
}

private static void Team1Shots()
{
   //Do Work in here...then

   thread2.Start();
   thread2.Join(); //Go to thread2

   //When join in thread2 to here
   //Do the rest of the work

   //Get thread2 to finish
}

private static void Team2Shots()
{
   //Do Work in here...
   thread1.Join(); //Go back to thread1

   //When thread1 finishes
   //Do the rest of the work

   // Finished …
Run Code Online (Sandbox Code Playgroud)

c# multithreading join

0
推荐指数
1
解决办法
75
查看次数

标签 统计

c# ×2

anchor ×1

join ×1

multithreading ×1

regex ×1