APISampleUnitTestsCS.SymbolsAndSemantics.TestCode.TestCode C# (CSharp) Метод

TestCode() публичный Метод

public TestCode ( string textWithMarker ) : System
textWithMarker string
Результат System
            public TestCode(string textWithMarker)
            {
                // $ marks the position in source code. It's better than passing a manually calculated
                // int, and is just for test convenience. $ is a char that is used nowhere in the C#
                // language.
                Position = textWithMarker.IndexOf('$');
                if (Position != -1)
                {
                    textWithMarker = textWithMarker.Remove(Position, 1);
                }

                Text = textWithMarker;
                SyntaxTree = SyntaxTree.ParseText(Text);

                if (Position != -1)
                {
                    Token = SyntaxTree.GetRoot().FindToken(Position);
                    SyntaxNode = Token.Parent;
                }

                Compilation = Compilation
                    .Create("test")
                    .AddSyntaxTrees(SyntaxTree)
                    .AddReferences(new MetadataFileReference(typeof(object).Assembly.Location));

                SemanticModel = Compilation.GetSemanticModel(SyntaxTree);
            }