ICSharpCode.NRefactory.Ast.TypeDeclaration.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
        public override string ToString()
        {
            return string.Format("[TypeDeclaration Name={0} Type={1} BaseTypes={2} Templates={3} BodyStartLocation=" +
                    "{4} Attributes={5} Modifier={6}]", Name, Type, GetCollectionString(BaseTypes), GetCollectionString(Templates), BodyStartLocation, GetCollectionString(Attributes), Modifier);
        }

Usage Example

    private static void InsertConstructors(ProcessTemplate template, TypeDeclaration t)
    {
        // foreach constructor create a method
        List <ConstructorDeclaration>constructors = CSParser.GetConstructors(t);

        if (constructors.Count == 0)
        {
            // will cause compile error if the constructor is missing, because it is not implementing the interface completely
            throw new Exception("missing a connector constructor in " + t.Name + "; details: " + t.ToString());
        }

        // find constructor and copy the parameters
        foreach (ConstructorDeclaration m in constructors)
        {
            ProcessTemplate methodSnippet = ClientRemotingClassTemplate.GetSnippet("METHOD");

            methodSnippet.SetCodelet("METHODNAME", t.Name.Substring(1, t.Name.Length - 1 - "UIConnector".Length));
            methodSnippet.SetCodelet("RETURNTYPE", CSParser.GetImplementedInterface(t));

            string ParameterDefinition = string.Empty;
            string ActualParameters = string.Empty;

            AutoGenerationTools.FormatParameters(m.Parameters, out ActualParameters, out ParameterDefinition);

            methodSnippet.SetCodelet("PARAMETERDEFINITION", ParameterDefinition);
            methodSnippet.SetCodelet("ACTUALPARAMETERS", ActualParameters);
            methodSnippet.SetCodelet("RETURN", "return ");

            template.InsertSnippet("METHODSANDPROPERTIES", methodSnippet);
        }
    }