Difference between DebuggerDisplayAttribute and DebuggerDisplay

[DebuggerDisplayAttribute("{_name}")]

vs

[DebuggerDisplay("{_name}")]

Is there any difference? Is this an alias of another? Does VS automatically check for a class named fooAttribute when using an attribute named foo?

+3
source share
3 answers

There is no difference. The standard convention for naming a class is to add the word "Attribute", as in:

public class AlertAttribute : Attribute {}

When using the attribute, the standard convention is to exclude the word, as in:

[Alert()]

From attributes (C # and Visual Basic) to http://msdn.microsoft.com/en-us/library/z0w1kczw.aspx

"" .NET Framework. . , [DllImport] [DllImportAttribute], DllImportAttribute - .NET. Framework.

+5

, # , .

+9
They are the same. You usually see the full name in the generated code, especially this output through CodeDom.

You can use any of them. The compiler generates the same thing at the end.

+5
source

Source: https://habr.com/ru/post/1719324/


All Articles