Beispiel #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 (IsConst)
            {
                builder.Append("const ");
            }
            else
            {
                if (IsStatic)
                {
                    builder.Append("static ");
                }
                if (IsReadonly)
                {
                    builder.Append("readonly ");
                }
            }

            builder.AppendFormat("{0} {1}", Type, Name);
            if (HasInitialValue)
            {
                builder.AppendFormat(" = {0}", InitialValue);
            }

            return(builder.ToString());
        }
Beispiel #2
0
        public override string ToString()
        {
            StringBuilder builder = new StringBuilder(100);

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

            if (string.IsNullOrEmpty(Type))
            {
                builder.AppendFormat("{0}(", Name);
            }
            else
            {
                builder.AppendFormat("{0} {1}(", Type, Name);
            }

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

            return(builder.ToString());
        }
Beispiel #3
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("event {0} {1}", Type, Name);
            return(builder.ToString());
        }
Beispiel #4
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());
        }