Home > Code Generation > Declare Attribute CodeRush code provider

Declare Attribute CodeRush code provider

June 1st, 2012

Attributes provide a powerful method of associating declarative information by decorating elements of the code, such as types, methods, properties, parameters and assemblies. Once an attribute is associated with a program entity, it can be queried at run time and used in various cases, for example, associating a help document with program entities (via the Help attribute), or marking an item as out of date (via the Obsolete attribute).

As the name says, the Declare Attribute code provider generates a new attribute class for an undeclared attribute reference:

CodeRush Declare Attribute preview

It adds the appropriate AttributeUsage attribute for the newly declared attribute with the corresponding attribute target, which can be easily modified using the Text Fields CodeRush feature:

CodeRush Declare Attribute result step#1

Simply press Enter when you are done with the name of the attribute and you will be navigated to the attribute target for further modification:

CodeRush Declare Attribute result step#2

If the attribute target is valid, pressing the Enter key for the second time will move you inside the constructor of the class.

—–
Products: CodeRush Pro
Versions: 12.1 and up
VS IDEs: 2008 and up
Updated: Sep/21/2012
ID: C167

Similar Posts:

  1. June 7th, 2012 at 15:48 | #1

    Fatal error: Uncaught Error: Call to undefined function eregi_replace() in H:\root\home\megazoid-001\www\skorkincom\wp-content\plugins\bbcomments\BBComments.php:41 Stack trace: #0 H:\root\home\megazoid-001\www\skorkincom\wp-includes\class-wp-hook.php(289): render_comment() #1 H:\root\home\megazoid-001\www\skorkincom\wp-includes\plugin.php(212): WP_Hook->apply_filters() #2 H:\root\home\megazoid-001\www\skorkincom\wp-includes\comment-template.php(1028): apply_filters() #3 H:\root\home\megazoid-001\www\skorkincom\wp-content\themes\inove\functions.php(1163): comment_text() #4 H:\root\home\megazoid-001\www\skorkincom\wp-includes\class-walker-comment.php(179): custom_comments() #5 H:\root\home\megazoid-001\www\skorkincom\wp-includes\class-wp-walker.php(144): Walker_Comment->start_el() #6 H:\root\home\megazoid-001\www\skorkincom\wp-includes\class-walker-comment.php(139): Walker->display_element() #7 H:\root\home\megazoid-001\www\skorkincom\wp-includes\class-wp-walker.php(332): Walker_Comment->display_element() #8 H:\root\home\me in H:\root\home\megazoid-001\www\skorkincom\wp-content\plugins\bbcomments\BBComments.php on line 41
    WordPress › Error

    There has been a critical error on this website.

    Learn more about debugging in WordPress.