MetadataStringComparer 結構

定義

提供字串比較協助程式,以在中繼資料中查詢字串,同時盡可能避免配置。

public value class MetadataStringComparer
public struct MetadataStringComparer
public readonly struct MetadataStringComparer
type MetadataStringComparer = struct
Public Structure MetadataStringComparer
繼承
MetadataStringComparer

備註

除非 handle 自變數和 value 自變數包含非 ASCII 文字,否則不會執行配置。

使用 StringComparer取得實例。 默認初始化的實例是無用的,且行為為 null 參考。

程式代碼已優化,因此重新取得比較子時不會有額外的額外負荷,而無法將其指派給本機。 也就是說,建構如下:

if (reader.StringComparer.Equals(typeDef.Namespace, "System") && reader.StringComparer.Equals(typeDef.Name, "Object")
{
    /* found System.Object */
}

效率不低於:

var comparer = reader.StringComparer;
if (comparer.Equals(typeDef.Namespace, "System") && comparer.Equals(typeDef.Name, "Object") 
{ 
    /* found System.Object */
}

因此,兩者之間的選擇是其中一種樣式,而不是效能。

方法

Equals(DocumentNameBlobHandle, String)

提供字串比較協助程式,以在中繼資料中查詢字串,同時盡可能避免配置。

Equals(DocumentNameBlobHandle, String, Boolean)

提供字串比較協助程式,以在中繼資料中查詢字串,同時盡可能避免配置。

Equals(NamespaceDefinitionHandle, String)

提供字串比較協助程式,以在中繼資料中查詢字串,同時盡可能避免配置。

Equals(NamespaceDefinitionHandle, String, Boolean)

提供字串比較協助程式,以在中繼資料中查詢字串,同時盡可能避免配置。

Equals(StringHandle, String)

提供字串比較協助程式,以在中繼資料中查詢字串,同時盡可能避免配置。

Equals(StringHandle, String, Boolean)

提供字串比較協助程式,以在中繼資料中查詢字串,同時盡可能避免配置。

StartsWith(StringHandle, String)

提供字串比較協助程式,以在中繼資料中查詢字串,同時盡可能避免配置。

StartsWith(StringHandle, String, Boolean)

提供字串比較協助程式,以在中繼資料中查詢字串,同時盡可能避免配置。

適用於