When should I use Debug.Assert()?

后端 未结 20 1713
说谎
说谎 2020-11-30 16:12

I\'ve been a professional software engineer for about a year now, having graduated with a CS degree. I\'ve known about assertions for a while in C++ and C, but had no idea t

20条回答
  •  醉酒成梦
    2020-11-30 17:05

    I don't know how it is in C# and .NET, but in C will assert() only work if compiled with -DDEBUG - the enduser will never see an assert() if it's compiled without. It's for developer only. I use it really often, it's sometimes easier to track bugs.

提交回复
热议问题