В приведенном ниже коде во второй консоли. Кто -нибудь может сказать мне почему? < /P>
public class Retailer
{
public void retailerFunc()
{
ChickenFarm chicken = new ChickenFarm();
for (Int32 i = 0; i < 10; i++)
{
Thread.Sleep(1000);
Int32 p = chicken.getPrice();
Console.WriteLine("Store{0} has everyday low price: ${1} each",
Thread.CurrentThread.Name, p); // Thread.CurrentThread.Name prints thread name
}
}
public void chickenOnSale(Int32 p)
{
// order chickens from chicken farm – send order into queue
Console.WriteLine("Store{0} chickens are on sale: as low as ${1} each",
Thread.CurrentThread.Name, p); // Thread.CurrentThread.Name cannot print a name
}
}
Подробнее здесь: https://stackoverflow.com/questions/274 ... hread-name
Имя потока не отображается в Thread.currentThread.name [закрыто] ⇐ C#
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение