MatchAttribute クラスとは? わかりやすく解説

MatchAttribute クラス

テキストパターン一致により一致した属性表します。このクラス継承できません。

名前空間: System.Web.Services.Protocols
アセンブリ: System.Web.Services (system.web.services.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.All)> _
Public NotInheritable Class
 MatchAttribute
    Inherits Attribute
Dim instance As MatchAttribute
[AttributeUsageAttribute(AttributeTargets.All)] 
public sealed class MatchAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::All)] 
public ref class MatchAttribute sealed : public
 Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.All) */ 
public final class MatchAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.All) 
public final class MatchAttribute extends
 Attribute
解説解説
使用例使用例
Imports System
Imports System.Web.Services.Protocols


Public Class MatchAttribute_Example
    Inherits HttpGetClientProtocol

    Public Sub New()
        Url = "http://localhost"
    End Sub 'New

    <HttpMethodAttribute(GetType(TextReturnReader), GetType(UrlParameterWriter))>
 _
    Public Function GetHeaders() As
 Headers
        Return CType(Invoke("GetHeaders",
 Url + "/MyHeaders.html", New
 Object(0) {}), Headers)
    End Function 'GetHeaders


    Public Function BeginGetHeaders(ByVal
 callback As System.AsyncCallback, ByVal asyncState
 As Object) As _
                                                                         System.IAsyncResult
        Return BeginInvoke("GetHeaders",
 Url + "/MyHeaders.html", New
 Object(0) {}, _
                                                                          callback,
 asyncState)
    End Function 'BeginGetHeaders


    Public Function EndGetHeaders(ByVal
 asyncResult As System.IAsyncResult) As Headers
        Return CType(EndInvoke(asyncResult), Headers)
    End Function 'EndGetHeaders
End Class 'MatchAttribute_Example
    

Public Class Headers

    <MatchAttribute("TITLE>(.*?)<")> _
    Public Title As String

    <MatchAttribute("", Pattern:="h1>(.*?)<",
 IgnoreCase:=True)> _
    Public H1 As String

    <MatchAttribute("H2>((([^<,]*),?)+)<",
 Group:=3, Capture:=4)> _
    Public Element As String

    <MatchAttribute("H2>((([^<,]*),?){2,})<",
 Group:=3, MaxRepeats:=0)> _
    Public Elements1() As String

    <MatchAttribute("H2>((([^<,]*),?){2,})<",
 Group:=3, MaxRepeats:=1)> _
    Public Elements2() As String

    <MatchAttribute("H3 ([^=]*)=([^>]*)", Group:=1)>
 _
    Public Attribute As String

    <MatchAttribute("H3 ([^=]*)=([^>]*)", Group:=2)>
 _
    Public Value As String
End Class 'Headers

using System;
using System.Web.Services.Protocols;

public class MatchAttribute_Example : HttpGetClientProtocol
{
    public MatchAttribute_Example()
    {
        Url = "http://localhost";
    }

    [HttpMethodAttribute(typeof(TextReturnReader), typeof(UrlParameterWriter))]
    public Example_Headers GetHeaders()
    {
        return ((Example_Headers)Invoke("GetHeaders",
 (Url + "/MyHeaders.html"),
            new object[0]));
    }

    public System.IAsyncResult BeginGetHeaders(System.AsyncCallback
 callback,
        object asyncState) 
    {
        return BeginInvoke("GetHeaders", (Url + "/MyHeaders.html"),
 
            new object[0], callback, asyncState);
    }

    public Example_Headers EndGetHeaders(System.IAsyncResult asyncResult)
 
    {
        return (Example_Headers)(EndInvoke(asyncResult));
    }
}
public class Example_Headers 
{    
    [MatchAttribute("TITLE>(.*?)<")]
    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;
}

#using <System.dll>
#using <System.Web.Services.dll>

using namespace System;
using namespace System::Web::Services::Protocols;

public ref class Example_Headers
{
public:

   [MatchAttribute("TITLE>(.*?)<")]
   String^ Title;

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

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

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

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

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

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

public ref class MatchAttribute_Example: public
 HttpGetClientProtocol
{
public:
   MatchAttribute_Example()
   {
      Url = "http://localhost";
   }

   [HttpMethodAttribute(TextReturnReader::typeid,UrlParameterWriter::typeid)]
   Example_Headers^ GetHeaders()
   {
      return ((Example_Headers^)(Invoke( "GetHeaders",
 ( Url + "/MyHeaders.html" ),
         gcnew array<Object^>(0) )));
   }

   System::IAsyncResult^ BeginGetHeaders( System::AsyncCallback^ callback,
      Object^ asyncState )
   {
      return BeginInvoke( "GetHeaders", ( Url + "/MyHeaders.html"
 ),
         gcnew array<Object^>(0), callback, asyncState );
   }

   Example_Headers^ EndGetHeaders( System::IAsyncResult^ asyncResult )
   {
      return (Example_Headers^)(EndInvoke( asyncResult ));
   }
};
import System.*;
import System.Web.Services.Protocols.*;

public class MatchAttribute_Example extends
 HttpGetClientProtocol
{
    public MatchAttribute_Example()
    {
        set_Url("http://localhost");
    } //MatchAttribute_Example

    /** @attribute HttpMethodAttribute(TextReturnReader.class,
 
        UrlParameterWriter.class)
     */
    public Example_Headers GetHeaders()
    {
        return (Example_Headers)Invoke("GetHeaders",
 get_Url() 
            + "/MyHeaders.html", new Object[0]);
    } //GetHeaders

    public System.IAsyncResult BeginGetHeaders(System.AsyncCallback
 callback, 
        Object asyncState)
    {
        return BeginInvoke("GetHeaders", get_Url() 
            + "/MyHeaders.html", new Object[0], callback,
 asyncState);
    } //BeginGetHeaders

    public Example_Headers EndGetHeaders(System.IAsyncResult asyncResult)
    {
        return (Example_Headers)EndInvoke(asyncResult);
    } //EndGetHeaders
} //MatchAttribute_Example

public class Example_Headers
{
    /** @attribute MatchAttribute("TITLE>(.*?)<")
     */
    public String title;

    /** @attribute MatchAttribute("", Pattern = "h1>(.*?)<",
 IgnoreCase = true)
     */
    public String h1;

    /** @attribute MatchAttribute("H2>((([^<,]*),?)+)<", Group
 = 3, Capture = 4)
     */
    public String element;

    /** @attribute MatchAttribute("H2>((([^<,]*),?){2,})<", Group
 = 3, 
        MaxRepeats = 0)
     */
    public String elements1[];

    /** @attribute MatchAttribute("H2>((([^<,]*),?){2,})<", Group
 = 3, 
        MaxRepeats = 1)
     */
    public String elements2[];

    /** @attribute MatchAttribute("H3 ([^=]*)=([^>]*)", Group = 1)
     */
    public String attribute;

    /** @attribute MatchAttribute("H3 ([^=]*)=([^>]*)", Group = 2)
     */
    public String value;
} //Example_Headers
継承階層継承階層
System.Object
   System.Attribute
    System.Web.Services.Protocols.MatchAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MatchAttribute メンバ
System.Web.Services.Protocols 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からMatchAttribute クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からMatchAttribute クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からMatchAttribute クラス を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「MatchAttribute クラス」の関連用語

MatchAttribute クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



MatchAttribute クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS