Ejemplo n.º 1
0
        public override string ToString()
        {
            StringBuilder builder = new StringBuilder(50);

            if (AccessModifier != AccessModifier.Default)
            {
                builder.Append(SyntaxHelper.GetAccessModifier(AccessModifier, Language.CSharp));
                builder.Append(" ");
            }
            if (Modifier != OperationModifier.None)
            {
                builder.Append(SyntaxHelper.GetOperationModifier(Modifier, Language.CSharp));
                builder.Append(" ");
            }
            if (IsStatic)
            {
                builder.Append("static");
                builder.Append(" ");
            }

            builder.AppendFormat("{0} {1}", Type, Name);

            if (ParameterList.Count > 0)
            {
                builder.Append("[");
                for (int i = 0; i < ParameterList.Count; i++)
                {
                    builder.Append(ParameterList[i]);
                    if (i < ParameterList.Count - 1)
                    {
                        builder.Append(", ");
                    }
                }
                builder.Append("]");
            }

            builder.Append(" { ");
            if (!IsWriteonly)
            {
                if (ReadAccess != AccessModifier.Default)
                {
                    builder.Append(SyntaxHelper.GetAccessModifier(
                                       ReadAccess, Language.CSharp));
                    builder.Append(" get; ");
                }
                else
                {
                    builder.Append("get; ");
                }
            }
            if (!IsReadonly)
            {
                if (WriteAccess != AccessModifier.Default)
                {
                    builder.Append(SyntaxHelper.GetAccessModifier(
                                       WriteAccess, Language.CSharp));
                    builder.Append(" set; ");
                }
                else
                {
                    builder.Append("set; ");
                }
            }
            builder.Append("}");

            return(builder.ToString());
        }