public bool HasItemsFromPropertySet(InfoItemPropertySet propertySet, CompositeInfoItem itemRemoved)
{
var itemAndSubItems = new InfoItemCollection();
if (itemRemoved != null)
{
itemAndSubItems.Add(itemRemoved);
//foreach (InfoItem item in itemRemoved.AllDescendants)
itemAndSubItems.AddRange(itemRemoved.AllDescendants);
}
return AllItems.AsParallel().Any(item => item.PropertySet == propertySet && !itemAndSubItems.Contains(item));
}
Above in my code I use AsParallel().Any()
How can i get thread ID of thread generated by that AsParellel.Any()...
Thread.CurrentThread.ManagedThreadId
gets the managed thread ID of the currently executing thread.
If you want to get the native thread ID instead (not something you normally want to do) you can call the method AppDomain.GetCurrentThreadId()
(obsoleted "because it does not provide a stable Id when managed threads are running on fibers" but as far as I know managed threads are only running on fibers inside SQL Server).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With