我试图在SQL中使用TRIM命令从字符串中删除特殊字符。事情是我似乎无法弄清楚如何删除'人物,就像当人们在他们的姓氏中使用它时。
例如O'Reilly
为了删除一个我必须引用它的字符,但是如何在引用或识别字符时使用它来引用它。
答案 0 :(得分:4)
您想使用using System;
using System.Threading;
using System.Collections.Generic;
public class PCQueue : IDisposable
{
private static readonly PCQueue instance = new TaskQueue(50);
readonly object _locker = new object();
Thread[] _workers;
Queue<Action> _itemQ = new Queue<Action>();
public PCQueue (int workerCount)
{
_workers = new Thread [workerCount];
// Create and start a separate thread for each worker
for (int i = 0; i < workerCount; i++)
(_workers [i] = new Thread (Consume)).Start();
}
public static PCQueue Instance
{
get
{
return instance;
}
}
public void Dispose()
{
// Enqueue one null item per worker to make each exit.
foreach (Thread worker in _workers) EnqueueItem (null);
}
public void EnqueueItem (Action item)
{
lock (_locker)
{
_itemQ.Enqueue (item); // We must pulse because we're
Monitor.Pulse (_locker); // changing a blocking condition.
}
}
void Consume()
{
while (true) // Keep consuming until
{ // told otherwise.
Action item;
lock (_locker)
{
while (_itemQ.Count == 0) Monitor.Wait (_locker);
item = _itemQ.Dequeue();
}
if (item == null) return; // This signals our exit.
item(); // Execute item.
}
}
}
而非 [HttpPost]
public async Task<IHttpActionResult> UpdateTask()
{
List<Email> email_address = new List<Email>(); // Assuming there are a few records here
// Update something here
PCQueue.Instance.EnqueueItem(() =>
{
SendEmail(email_address);
}
return Ok();
}
。然后,单引号的转义需要加倍,加上外部单引号。所以:
replace()
答案 1 :(得分:0)