MatchAttribute Constructor (String)


Initializes a new instance of the MatchAttribute class with the specified pattern.

Namespace:   System.Web.Services.Protocols
Assembly:  System.Web.Services (in System.Web.Services.dll)

public MatchAttribute(
	string pattern


Type: System.String

A string that represents the pattern to match.

Use this constructor to create and initialize a new instance of the MatchAttribute class using the specified pattern.

The following table shows the initial property value for an instance of MatchAttribute.


Initial Value


The value of the pattern parameter.

public class Example_Headers 
	public string Title;

	[MatchAttribute("", Pattern="h1>(.*?)<", IgnoreCase=true)]
	public string H1;

	[MatchAttribute("H2>((([^<,]*),?)+)<", Group=3, Capture=4)] 
	public string Element;

	[MatchAttribute("H2>((([^<,]*),?){2,})<", Group=3, MaxRepeats=0)] 
	public string[] Elements1;

	[MatchAttribute("H2>((([^<,]*),?){2,})<", Group=3, MaxRepeats=1)] 
	public string[] Elements2;

	[MatchAttribute("H3 ([^=]*)=([^>]*)", Group=1)]
	public string Attribute;

	[MatchAttribute("H3 ([^=]*)=([^>]*)", Group=2)]
	public string Value;

.NET Framework
Available since 1.1
Return to top