/// <summary> /// Verifies that the target field has a specified name. /// </summary> /// <param name="field"> /// The <see cref="SyntaxNode"/> the for which the name should be verified. /// </param> /// <param name="name"> /// The name that the target field should have. /// </param> /// <returns> /// <see cref="true"/> when the target has the specified name, /// else <see cref="false"/>. /// </returns> public static bool HasName(this FieldDeclarationSyntax field, string name) { _ = field ?? throw new ArgumentNullException(nameof(field)); _ = name ?? throw new ArgumentNullException(nameof(name)); if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("The name cannot be empty.", nameof(name)); } return(field.GetIdentifierName() == name); }