RobotsRule Class

Represents a single Allow or Disallow directive in a robots.txt file.

public sealed class RobotsRule

Remarks

Path patterns support Google's wildcard extensions:

  • * matches any sequence of characters (zero or more).
  • $ at the end of the pattern anchors the match to the end of the path.

Constructors

NameDescription
RobotsRule(RobotsRuleKind, string)

RobotsRule(RobotsRuleKind, string)

RobotsRule.cs
public RobotsRule(RobotsRuleKind kind, string value)

Parameters

kind RobotsRuleKind
value string

No documentation is available.

Properties

NameDescription
KindGets whether this rule allows or disallows access.
ValueGets the raw path pattern as it appears in the robots.txt file.

Gets whether this rule allows or disallows access.

public RobotsRuleKind Kind { get; }

Property value

RobotsRuleKind

Gets the raw path pattern as it appears in the robots.txt file.

public string Value { get; }

Property value

string

Methods

NameDescription
Matches(ReadOnlySpan<char>)Determines whether the given path matches this rule's pattern, using Google's wildcard semantics (* and $).
Matches(string)Determines whether the given path matches this rule's pattern, using Google's wildcard semantics (* and $).
ToString()Returns a string that represents the current object.

Matches overloads

Matches(ReadOnlySpan<char>)

RobotsRule.cs

Determines whether the given path matches this rule's pattern, using Google's wildcard semantics (* and $).

public bool Matches(ReadOnlySpan<char> path)
Parameters
path ReadOnlySpan<char>
Returns

bool

Matches(string)

RobotsRule.cs

Determines whether the given path matches this rule's pattern, using Google's wildcard semantics (* and $).

public bool Matches(string path)
Parameters
path string
The URL path (and optional query string) to test.
Returns

bool true if path matches; otherwise false.

ToString()

RobotsRule.cs

Returns a string that represents the current object.

public override string ToString()

Returns

string A string that represents the current object.