当前位置: 首页>>代码示例>>C#>>正文


C# Material.GetHashCode方法代码示例

本文整理汇总了C#中Material.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Material.GetHashCode方法的具体用法?C# Material.GetHashCode怎么用?C# Material.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Material的用法示例。


在下文中一共展示了Material.GetHashCode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddMaterial

        /// <summary>
        /// Adds the material.
        /// </summary>
        /// <param name="material">The material.</param>
        /// <returns>The ID of material.</returns>
        public int AddMaterial(Material material)
        {
            foreach (var currentMaterial in _materials
                .Select((currentMaterial, index) => new { Material = currentMaterial, Index = index })
                .Where(currentMaterial => currentMaterial.Material.GetHashCode() == material.GetHashCode() && currentMaterial.Material == material))
            {
                return currentMaterial.Index;
            }

            _materials.Add(material);
            return _materials.Count - 1;
        }
开发者ID:Bloyteg,项目名称:AW.Tools,代码行数:17,代码来源:Model.cs

示例2: Material_GetHashCode_returns_same_hash_for_same_object

 public void Material_GetHashCode_returns_same_hash_for_same_object()
 {
     var m1 = new Material();
       var m2 = m1;
       var hash1 = m1.GetHashCode();
       var hash2 = m2.GetHashCode();
       Assert.AreEqual(hash1, hash2);
 }
开发者ID:EddPorter,项目名称:RayManCS,代码行数:8,代码来源:MaterialTests.cs

示例3: Material_GetHashCode_returns_different_hashes_for_different_objects

 public void Material_GetHashCode_returns_different_hashes_for_different_objects()
 {
     var m1 = new Material() {
     Colour = System.Drawing.Color.Green,
     Reflectance = 0.3f,
     SpecularPower = 50,
     SpecularTerm = 1.2f
       };
       var m2 = new Material() {
     Colour = System.Drawing.Color.Teal,
     Reflectance = 0.5f,
     SpecularPower = 80,
     SpecularTerm = 0.8f
       };
       var hash1 = m1.GetHashCode();
       var hash2 = m2.GetHashCode();
       Assert.AreNotEqual(hash1, hash2);
 }
开发者ID:EddPorter,项目名称:RayManCS,代码行数:18,代码来源:MaterialTests.cs

示例4: Material_GetHashCode_returns_same_hash_for_equivalent_objects

 public void Material_GetHashCode_returns_same_hash_for_equivalent_objects()
 {
     var m1 = new Material() {
     Colour = System.Drawing.Color.Green,
     Reflectance = 0.3f,
     SpecularPower = 50,
     SpecularTerm = 1.2f
       };
       var m2 = new Material() {
     Colour = System.Drawing.Color.Green,
     Reflectance = 0.3f,
     SpecularPower = 50,
     SpecularTerm = 1.2f
       };
       var hash1 = m1.GetHashCode();
       var hash2 = m2.GetHashCode();
       Assert.AreEqual(hash1, hash2);
 }
开发者ID:EddPorter,项目名称:RayManCS,代码行数:18,代码来源:MaterialTests.cs

示例5: Material_GetHashCode_returns

 public void Material_GetHashCode_returns()
 {
     Material m = new Material();
       m.GetHashCode();
 }
开发者ID:EddPorter,项目名称:RayManCS,代码行数:5,代码来源:MaterialTests.cs


注:本文中的Material.GetHashCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。