Aracılığıyla paylaş


VCAssemblyReference.MatchName(String, Boolean) Method

Definition

Matches a specified name to the name of a collection item.

public:
 bool MatchName(System::String ^ NameToMatch, bool FullOnly);
public:
 bool MatchName(Platform::String ^ NameToMatch, bool FullOnly);
bool MatchName(std::wstring const & NameToMatch, bool FullOnly);
[System.Runtime.InteropServices.DispId(675)]
public bool MatchName (string NameToMatch, bool FullOnly);
[<System.Runtime.InteropServices.DispId(675)>]
abstract member MatchName : string * bool -> bool
Public Function MatchName (NameToMatch As String, FullOnly As Boolean) As Boolean

Parameters

NameToMatch
String

Required. The name to match.

FullOnly
Boolean

Required. true if you want MatchName(String, Boolean) to match the full name of the string. false if you want to allow a match on the short name of the string.

Setting MatchName(String, Boolean) to true is useful for projects, folders, and files, and requires an absolute path to match. A folder's absolute path is the concatenation of the folder names above it, with its own name. A top-level folder's full name would be the same as its name. If a folder named Source Files contains a subfolder named MyProject, the MyProject folder full name is Source Files\MyProject.

Returns

true if the name was matched; otherwise, false.

Implements

Attributes

Examples

The following sample code modifies the MatchName method of the VCPlatform in the integrated development environment (IDE):

' add reference to Microsoft.VisualStudio.VCProjectEngine.  
Imports EnvDTE  
Imports Microsoft.VisualStudio.VCProjectEngine  

Public Module Module1  
    Sub Test()  
        Dim prj As VCProject  
        Dim cfgs, tools As IVCCollection  
        Dim cfg As VCConfiguration  
        Dim p As VCPlatform  
        prj = DTE.Solution.Projects.Item(1).Object  
        p = prj.Platforms(1)  

        If p.MatchName("Win32", True) Then  
            p.ExecutableDirectories = "T"  
        End If  

    End Sub  
End Module  

Remarks

MatchName is a method that operates on a collection item. If you are iterating over the members of a collection, you can use the MatchName method to determine whether the current item is the one in which you are interested.

You can also use MatchName to match debug configurations, regardless of the platform (which is part of the full name Debug\Win32).

You cannot use MatchName for indexing into a collection. Indexing implies using the [] operator or its equivalent .Item() method, and MatchName does not affect either process.

See How to: Compile Example Code for Project Model Extensibility for information about how to compile and run this sample.

Applies to