本文整理汇总了C#中System.Net.Http.Headers.ContentDispositionHeaderValue.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# ContentDispositionHeaderValue.GetHashCode方法的具体用法?C# ContentDispositionHeaderValue.GetHashCode怎么用?C# ContentDispositionHeaderValue.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Http.Headers.ContentDispositionHeaderValue
的用法示例。
在下文中一共展示了ContentDispositionHeaderValue.GetHashCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetHashCode_UseContentDispositionWithAndWithoutParameters_SameOrDifferentHashCodes
public void GetHashCode_UseContentDispositionWithAndWithoutParameters_SameOrDifferentHashCodes()
{
ContentDispositionHeaderValue contentDisposition1 = new ContentDispositionHeaderValue("inline");
ContentDispositionHeaderValue contentDisposition2 = new ContentDispositionHeaderValue("inline");
contentDisposition2.Name = "myname";
ContentDispositionHeaderValue contentDisposition3 = new ContentDispositionHeaderValue("inline");
contentDisposition3.Parameters.Add(new NameValueHeaderValue("name", "value"));
ContentDispositionHeaderValue contentDisposition4 = new ContentDispositionHeaderValue("INLINE");
ContentDispositionHeaderValue contentDisposition5 = new ContentDispositionHeaderValue("INLINE");
contentDisposition5.Parameters.Add(new NameValueHeaderValue("NAME", "MYNAME"));
Assert.NotEqual(contentDisposition1.GetHashCode(), contentDisposition2.GetHashCode()); // "No params vs. name."
Assert.NotEqual(contentDisposition1.GetHashCode(), contentDisposition3.GetHashCode()); // "No params vs. custom param."
Assert.NotEqual(contentDisposition2.GetHashCode(), contentDisposition3.GetHashCode()); // "name vs. custom param."
Assert.Equal(contentDisposition1.GetHashCode(), contentDisposition4.GetHashCode()); // "Different casing."
Assert.Equal(contentDisposition2.GetHashCode(), contentDisposition5.GetHashCode()); // "Different casing in name."
}