/// <summary> /// Performs a syntax transform of the source code which is passed in as a string. The transform to be performed is also passed as an argument /// </summary> /// <param name="sourceText">Text of the source code which is to be transformed</param> /// <param name="transformKind">The kind of Syntax Transform that needs to be performed on the source</param> /// <returns>Transformed source code as a string</returns> public static string Transform(string sourceText, TransformKind transformKind) { var sourceTree = SyntaxFactory.ParseSyntaxTree(sourceText); TransformVisitor visitor = new TransformVisitor(sourceTree, transformKind); return visitor.Visit(sourceTree.GetRoot()).ToFullString(); }