Write custom features

Source: Internet
Author: User

========================================= Document. CS

Using system; using system. collections. generic; using system. LINQ; using system. text; using system. threading. tasks; namespace consoleapplication2 {[attributeusage (attributetargets. property, // The range to which this feature can be applied (only for properties) allowmultiple = true, // whether multiple applications can be applied to the same item inherited = true) // If a feature is applied to a class or interface, it is automatically applied to all derived classes or interfaces.] // If a feature is applied to a property or method, public class documentattribute: attribute {private string m_strname; private bool m_blnisyes; Public bool isyes {get {return m_blnisyes ;} set {m_blnisyes = value;} public documentattribute (string p_name) {This. m_strname = p_name ;}}}

=================================== Main program

Using system; using system. collections. generic; using system. LINQ; using system. text; using system. threading. tasks; namespace consoleapplication2 {class program {// specify the feature [document ("Document 1", // the value required by the constructor isyes = true)] // optional parameter (document class attribute) Public string name {Get; set;} static void main (string [] ARGs ){}}}

This article is from the "programmer's home-Hunter" blog, please be sure to keep this source http://962410314.blog.51cto.com/7563109/1569008

Write custom features

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.