ToString() public method

public ToString ( ) : string
return string
        public override string ToString()
        {
            // MS runtime produces a NullReferenceException here if CommandID property == null
            // which I guess isn't a good idea (throwing exceptions in ToStrings???) - bug in MS??
            string commandpart = string.Empty;

            if (command != null)
            {
                commandpart = command.ToString();
            }
            commandpart = string.Concat(commandpart, " : ");
            if (this.Supported)
            {
                commandpart = string.Concat(commandpart, "Supported");
            }
            if (this.Enabled)
            {
                commandpart = string.Concat(commandpart, "|Enabled");
            }
            if (this.Visible)
            {
                commandpart = string.Concat(commandpart, "|Visible");
            }
            if (this.Checked)
            {
                commandpart = string.Concat(commandpart, "|Checked");
            }
            return(commandpart);
        }
Example #2
0
        /// <summary>Returns a string representation of this menu command.</summary>
        /// <returns>A string containing the value of the <see cref="P:System.ComponentModel.Design.MenuCommand.CommandID" /> property appended with the names of any flags that are set, separated by pipe bars (|). These flag properties include <see cref="P:System.ComponentModel.Design.MenuCommand.Checked" />, <see cref="P:System.ComponentModel.Design.MenuCommand.Enabled" />, <see cref="P:System.ComponentModel.Design.MenuCommand.Supported" />, and <see cref="P:System.ComponentModel.Design.MenuCommand.Visible" />.</returns>
        public override string ToString()
        {
            string str = string.Empty;

            if (command != null)
            {
                str = command.ToString();
            }
            str += " : ";
            if (Supported)
            {
                str += "Supported";
            }
            if (Enabled)
            {
                str += "|Enabled";
            }
            if (Visible)
            {
                str += "|Visible";
            }
            if (Checked)
            {
                str += "|Checked";
            }
            return(str);
        }
Example #3
0
        // Convert this object into a string.
        public override String ToString()
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(command.ToString());
            builder.Append(" : ");
            bool haveItem = false;

            if ((oleStatus & OleStatus_Supported) != 0)
            {
                builder.Append("Supported");
                haveItem = true;
            }
            if ((oleStatus & OleStatus_Enabled) != 0)
            {
                if (!haveItem)
                {
                    builder.Append('|');
                }
                builder.Append("Enabled");
                haveItem = true;
            }
            if ((oleStatus & OleStatus_Invisible) == 0)
            {
                if (!haveItem)
                {
                    builder.Append('|');
                }
                builder.Append("Visible");
                haveItem = true;
            }
            if ((oleStatus & OleStatus_Checked) != 0)
            {
                if (!haveItem)
                {
                    builder.Append('|');
                }
                builder.Append("Checked");
                haveItem = true;
            }
            return(builder.ToString());
        }
Example #4
0
        /// <devdoc>
        ///    Overrides object's ToString().
        /// </devdoc>
        public override string ToString()
        {
            string str = CommandID.ToString() + " : ";

            if ((status & SUPPORTED) != 0)
            {
                str += "Supported";
            }
            if ((status & ENABLED) != 0)
            {
                str += "|Enabled";
            }
            if ((status & INVISIBLE) == 0)
            {
                str += "|Visible";
            }
            if ((status & CHECKED) != 0)
            {
                str += "|Checked";
            }
            return(str);
        }