【愚公系列】2021年11月 C#版 数据结构与算法解析(映射)
【摘要】 using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Badao.Entity.Helper{ public class StepStateHelper { #region 单例实现 private static strin...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Badao.Entity.Helper
{
public class StepStateHelper
{
#region 单例实现
private static string _lockFlag = "StepStateHelperLock";
private static StepStateHelper _instance;
private StepStateHelper()
{
}
public static StepStateHelper Instance
{
get
{
lock(_lockFlag)
{
if (_instance == null)
{
_instance = new StepStateHelper();
}
return _instance;
}
}
}
#endregion
#region 字段定义
private Dictionary<short, string> _dicStepStates = new Dictionary<short, string>()
{
{ 0x04, "霸道" },
{ 0x05, "流氓" },
{ 0x06, "气质" },
};
#endregion
#region 属性定义
public Dictionary<short, string> DicStepStates
{
get
{
return _dicStepStates;
}
}
#endregion
}
}
string StepState = "";
StepStateHelper.Instance.DicStepStates.TryGetValue((short)obj, out StepState);
以上就是基本类映射的实现
【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)