本文整理汇总了C#中Enum.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Enum.GetHashCode方法的具体用法?C# Enum.GetHashCode怎么用?C# Enum.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enum
的用法示例。
在下文中一共展示了Enum.GetHashCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnInspectorGUI
public override void OnInspectorGUI()
{
_infectionEvent.boolValue = EditorGUILayout.Toggle("Infection Event", _infectionEvent.boolValue);
_rateChange.boolValue = EditorGUILayout.BeginToggleGroup("Set New Infection Value", _rateChange.boolValue);
EditorGUILayout.HelpBox("-1=Bad, 0-Infection Start, 1=Cleanest", MessageType.Info);
_setInfectionLevel.floatValue =
EditorGUILayout.Slider("New Infection Value", _setInfectionLevel.floatValue,
-1f, 1f);
EditorGUILayout.EndToggleGroup();
_infectionRate.floatValue =
EditorGUILayout.Slider("Infection Rate", _infectionRate.floatValue, 0, 15);
_type = (WildcardRoomType) _targetRoom.enumValueIndex;
_type = EditorGUILayout.EnumPopup("Targetted Room", _type);
_targetRoom.enumValueIndex = _type.GetHashCode();
serializedObject.ApplyModifiedProperties();
EditorGUILayout.HelpBox(
"The message here can either be a custom message or one from the locale folder (preferable) using the key name of the message.\nE.g. EYES_INFECT_1",
MessageType.Info);
_textToDisplay.stringValue = EditorGUILayout.TextField("Message", _textToDisplay.stringValue);
}
示例2: Equals
public static void Equals(Enum e, object obj, bool expected)
{
Assert.Equal(expected, e.Equals(obj));
Assert.Equal(e.GetHashCode(), e.GetHashCode());
}