Beispiel #1
0
        public static AssignmentExpressionSyntax SimpleAssignment(
            SyntaxToken leftIdentifier,
            SyntaxToken rightIdentifier)
        {
            ThrowHelpers.ThrowIfNotIdentifier(nameof(leftIdentifier), leftIdentifier);
            ThrowHelpers.ThrowIfNotIdentifier(nameof(rightIdentifier), rightIdentifier);

            return(SimpleAssignment(
                       SyntaxFactory.IdentifierName(leftIdentifier),
                       SyntaxFactory.IdentifierName(rightIdentifier)));
        }
Beispiel #2
0
        public static SyntaxToken UppercaseIdentifierFirstLetter(SyntaxToken identifier)
        {
            ThrowHelpers.ThrowIfNotIdentifier(nameof(identifier), identifier);

            if (identifier.Value is string s && s.Length >= 1)
            {
                var newString = char.ToUpperInvariant(s[0]) + (s.Length >= 2 ? s.Substring(1) : string.Empty);
                return(SF.Identifier(newString));
            }

            return(identifier);
        }