|
82 | 82 |
|
83 | 83 | The objects used as keys by a <xref:System.Collections.Hashtable> are required to override the <xref:System.Object.GetHashCode%2A?displayProperty=nameWithType> method (or the <xref:System.Collections.IHashCodeProvider> interface) and the <xref:System.Object.Equals%2A?displayProperty=nameWithType> method (or the <xref:System.Collections.IComparer> interface). The implementation of both methods or interfaces must handle case sensitivity the same way; otherwise, the <xref:System.Collections.Hashtable> might behave incorrectly. For example, when creating a <xref:System.Collections.Hashtable>, you must use this class with the <xref:System.Collections.CaseInsensitiveComparer> class or any case-insensitive <xref:System.Collections.IComparer> implementation. |
84 | 84 |
|
85 | | -
|
86 | | -
|
87 | | -## Examples |
88 | | - The following code example creates a case-sensitive hash table and a case-insensitive hash table and demonstrates the difference in their behavior, even if both contain the same elements. |
89 | | - |
90 | | - :::code language="csharp" source="~/snippets/csharp/System.Collections/CaseInsensitiveComparer/Overview/caseinsensitive.cs" id="Snippet1"::: |
91 | | - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/VB/caseinsensitive.vb" id="Snippet1"::: |
92 | | -
|
93 | 85 | ]]></format> |
94 | 86 | </remarks> |
95 | 87 | <altmember cref="T:System.Collections.Hashtable" /> |
|
150 | 142 | ## Remarks |
151 | 143 | When the <xref:System.Collections.CaseInsensitiveHashCodeProvider> instance is created using this constructor, the <xref:System.Threading.Thread.CurrentCulture%2A?displayProperty=nameWithType> of the current thread is saved. Comparison procedures use the saved culture to determine the casing rules; therefore, hash code comparisons might have different results depending on the culture. For more information on culture-specific comparisons, see the <xref:System.Globalization> namespace and [Globalization and Localization](/dotnet/standard/globalization-localization/). |
152 | 144 |
|
153 | | -
|
154 | | -
|
155 | | -## Examples |
156 | | - The following code example creates a case-sensitive hash table and a case-insensitive hash table and demonstrates the difference in their behavior, even if both contain the same elements. |
157 | | -
|
158 | | - :::code language="csharp" source="~/snippets/csharp/System.Collections/CaseInsensitiveComparer/Overview/caseinsensitive.cs" id="Snippet1"::: |
159 | | - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/VB/caseinsensitive.vb" id="Snippet1"::: |
160 | | -
|
161 | 145 | ]]></format> |
162 | 146 | </remarks> |
163 | 147 | <altmember cref="P:System.Threading.Thread.CurrentCulture" /> |
|
210 | 194 | ## Remarks |
211 | 195 | Comparison procedures use the specified <xref:System.Globalization.CultureInfo?displayProperty=nameWithType> to determine the casing rules. Hash code comparisons might have different results depending on the culture. For more information on culture-specific comparisons, see the <xref:System.Globalization> namespace and [Globalization and Localization](/dotnet/standard/globalization-localization/). |
212 | 196 |
|
213 | | -
|
214 | | -
|
215 | | -## Examples |
216 | | - The following code example creates a case-sensitive hash table and a case-insensitive hash table and demonstrates the difference in their behavior, even if both contain the same elements. |
217 | | -
|
218 | | - :::code language="csharp" source="~/snippets/csharp/System.Collections/CaseInsensitiveComparer/Overview/caseinsensitive.cs" id="Snippet1"::: |
219 | | - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/VB/caseinsensitive.vb" id="Snippet1"::: |
220 | | -
|
221 | 197 | ]]></format> |
222 | 198 | </remarks> |
223 | 199 | <exception cref="T:System.ArgumentNullException"> |
|
320 | 296 | ## Remarks |
321 | 297 | Comparison procedures use the <xref:System.Globalization.CultureInfo.InvariantCulture%2A?displayProperty=nameWithType> to determine the casing rules. Hash code comparisons might have different results depending on the culture. For more information on culture-specific comparisons, see the <xref:System.Globalization> namespace and [Globalization and Localization](/dotnet/standard/globalization-localization/). |
322 | 298 |
|
323 | | -
|
324 | | -
|
325 | | -## Examples |
326 | | - The following code example creates a case-sensitive hash table and a case-insensitive hash table and demonstrates the difference in their behavior, even if both contain the same elements. |
327 | | -
|
328 | | - :::code language="csharp" source="~/snippets/csharp/System.Collections/CaseInsensitiveComparer/Overview/caseinsensitive.cs" id="Snippet1"::: |
329 | | - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/VB/caseinsensitive.vb" id="Snippet1"::: |
330 | | -
|
331 | 299 | ]]></format> |
332 | 300 | </remarks> |
333 | 301 | <altmember cref="P:System.Globalization.CultureInfo.InvariantCulture" /> |
|
0 commit comments