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