Category Archives: attributes

Use the Obsolete attribute in C#

The Obsolete attribute tells the C# IDE that a method is outdated and should no longer be used. You can include a string to display to the developer. The string usually tells what newer method to use instead of the … Continue reading

Posted in attributes | Tagged , , , , , , , , , , | Leave a comment

Use the Conditional attribute to make a method non-callable in C#

The Conditional attribute makes a method callable depending on whether a compile-time constant is defined. If the constant is not defined, then the compiler ignores calls to that method. The following code makes the Test subroutine callable if either the … Continue reading

Posted in attributes, debugging | Tagged , , , , , , , , | Leave a comment

Use a type converter with a PropertyGrid control in C#

This example shows how you can use a type converter with a PropertyGrid control to let it display and edit compound properties. The example Use a PropertyGrid to let the user edit objects in C# shows how to use the … Continue reading

Posted in attributes, controls, OOP | Tagged , , , , , , , , , , , , , | 1 Comment

Use PropertyGrid descriptions and categories in C#

This example extends the post Use a PropertyGrid to let the user edit objects in C# to use PropertyGrid descriptions and categories. Just give a class’s properties the Description and Category attributes to make the PropertyGrid use them in its … Continue reading

Posted in attributes, controls, OOP | Tagged , , , , , , , , , , | Leave a comment