Pragma to suppress deprecated GetCurrentThreadId

K

KenDev

I would like to know if there is a pragma id that I can use to suppress the
warning I get (.NET 2.0) for the GetCurrentThreadId.

I want to use warnings as errors and I don't want to change the
GetCurrentThreadId as we in the testing stages for our product (I have read a
few comments about problems just switching to the ManagedThreadId).

Does such a pragma id exist, and if so, what is it?

Thanks,

ken
 
H

Hans Kesting

KenDev wrote on 23-9-2008 :
I would like to know if there is a pragma id that I can use to suppress the
warning I get (.NET 2.0) for the GetCurrentThreadId.

I want to use warnings as errors and I don't want to change the
GetCurrentThreadId as we in the testing stages for our product (I have read a
few comments about problems just switching to the ManagedThreadId).

Does such a pragma id exist, and if so, what is it?

Thanks,

ken

#pragma warning disable 0618
// the "obsolete" code that you still want to use
#pragma warning restore 0618


The "disable" line disables a specific compiler warning (0618 in this
case) from this line onward in this file.
The "restore" line restores normal behaviour from that line on.


Hans Kesting
 
J

Jon Skeet [C# MVP]

I would like to know if there is a pragma id that I can use to suppress the
warning I get (.NET 2.0)  for the GetCurrentThreadId.

I want to use warnings as errors and I don't want to change the
GetCurrentThreadId as we in the testing stages for our product (I have read a
few comments about problems just switching to the ManagedThreadId).

Does such a pragma id exist, and if so, what is it?

Use #pragma warning disable <WARNINGID> (and re-enable it) just round
the relevant lines of code.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top