MetadataStringComparer Struct
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides string comparison helpers to query strings in metadata while avoiding allocation if possible.
public value class MetadataStringComparer
public struct MetadataStringComparer
public readonly struct MetadataStringComparer
type MetadataStringComparer = struct
Public Structure MetadataStringComparer
- Inheritance
Remarks
No allocation is performed unless both the handle argument and the value argument contain non-ASCII text.
Obtain instances using StringComparer. A default-initialized instance is useless and behaves as a null
reference.
The code is optimized so that there is no additional overhead in re-obtaining a comparer over assigning it to a local. That is to say that a construct like:
if (reader.StringComparer.Equals(typeDef.Namespace, "System") && reader.StringComparer.Equals(typeDef.Name, "Object")
{
/* found System.Object */
}
is no less efficient than:
var comparer = reader.StringComparer;
if (comparer.Equals(typeDef.Namespace, "System") && comparer.Equals(typeDef.Name, "Object")
{
/* found System.Object */
}
The choice between them is therefore one of style and not performance.
Methods
Applies to
.NET
フィードバック
https://aka.ms/ContentUserFeedback。
近日公開予定: 2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub イシューを段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、以下を参照してください:フィードバックの送信と表示