Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Thursday, December 13, 2007

Handy C# tricks

Here are some handy C# tricks to increase productivity.
First, the code:

        //

        // Summary:

        //     Gets or sets a value that indicates whether the System.Web.UI.WebControls.MenuItem

        //     object is enabled, allowing the item to display a pop-out image and any child

        //     menu items.

        //

        // Returns:

        //     true if the menu item is enabled; otherwise, false.

        [Browsable(true)]

        [DefaultValue(true)]

        public bool Enabled { get; set; }

  • The [Browsable(true)] allows the properties window to display the property or event.
  • Default value does as you would expect if the variable is not directly set
  • Short cut get and sets! Simple.

No comments: