2009-08-12 11 views

答えて

18

でやりたいものです。

If Not Debugger.IsAttached Then 
    DoSomething() 
End If 

EDITあなたはいつも#Ifconditional compilationを使用し、デバッガが使用されているかどうかにかかわらず、デバッグビルドでDoSomethingコードをスキップしたい場合は、この

#IF DEBUG Then 
    DoSomething() 
#End If 
9

のようなもの、あなたが何を意味するのかデバッグモード?あなたはデバッグビルドを参照している場合、あなたはそれをテストするために#if DEBUGを使用することができます。

#if DEBUG 
    // this is included in a debug build 
#else 
    // this is not included in a debug build 
#endif 
1

あなたはIsDebuggerPresent機能を使用することができます

<DllImport("kernel32.dll", CharSet:=CharSet.Auto, ExactSpelling:=True)> _ 
Public Shared Function IsDebuggerPresent() As Boolean 
End Function 

if not isDebuggerPresent() then 
Do something() 
end if 
関連する問題