using System.Threading.Thread in a class library (portable) RRS feed

  • Question

  • Is this possible?

    Im trying to use 

     if (myDictionary[System.Threading.Thread.CurrentThread.ManagedThreadId] == 1)

    But i can get it to work, Thread isn't recognised, it just says namespace doesn't exist, i have added using System.Threading; the only option other than that that show sis threading.tasks, .thread wont show up at all.... 

    and if i try to add an assembly reference barley anything show sup, and nothing regards threading. 

    i think this is because its a class library portable? can i change it / work around? 

    any help? :/ 

    • Edited by CraigBaines Monday, December 8, 2014 7:53 PM
    Monday, December 8, 2014 7:33 PM


  • Hi,

    The problem is that the System.Threading namespace is not available on all the target platforms that a portable class library supports. I think for example Windows Phone 7.x do not have a Threading namespace.

    The one and only reason why you should use a portable class library is that you want to use it on different target plattforms, such as Windows 7, WinRT (Store App), Windows Phone 8.1, etc...

    So it unites all the common features. If one plattform does not have a Threading namespace, then you can not use it.

    Do you use a portable class library for the correct reason?

    Please provide more information about the platforms that you are targetting!

    Rgds MM

    PS: Do not forget to "mark as anser" if this was helpful to you. Thanks!

    • Proposed as answer by Bill ChungMVP Wednesday, December 10, 2014 6:19 AM
    • Marked as answer by Kristin Xie Tuesday, December 16, 2014 9:26 AM
    Tuesday, December 9, 2014 1:01 AM