当前位置: 首页 > wzjs >正文

淘宝找做网站福州seo排名优化

淘宝找做网站,福州seo排名优化,现在的网站开发方式,浙江建设厅网站查询Unity中将字典序列化,在预制体上能够看到字典的内容,也可以直接在预制体上拖拽给字典赋值 直接上代码 using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine;public class SerializableD…

Unity中将字典序列化,在预制体上能够看到字典的内容,也可以直接在预制体上拖拽给字典赋值

直接上代码

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;public class SerializableDic
{
}[Serializable]
public class SerializableDic<TKey, TValue> :SerializableDic,ISerializationCallbackReceiver,IDictionary<TKey, TValue>{[SerializeField] private List<SerializableKeyValuePair> list = new List<SerializableKeyValuePair>();[Serializable]private struct SerializableKeyValuePair{public TKey Key;public TValue Value;public SerializableKeyValuePair(TKey key, TValue value){Key = key;Value = value;}}#region key indexprivate Dictionary<TKey, int> KeyPositions{get { return _keyPositions.Value; }}private Lazy<Dictionary<TKey, int>> _keyPositions;public SerializableDic(){_keyPositions = new Lazy<Dictionary<TKey, int>>(MakeKeyPositions);}#endregionprivate Dictionary<TKey, int> MakeKeyPositions(){Dictionary<TKey, int> dictionary = new Dictionary<TKey, int>(list.Count);for (var i = 0; i < list.Count; i++){dictionary[list[i].Key] = i;}return dictionary;}public void OnBeforeSerialize(){}public void OnAfterDeserialize(){_keyPositions = new Lazy<Dictionary<TKey, int>>(MakeKeyPositions);}#region IDictionary<TKey, TValue>/// <summary>///  array[index]   dic[key]/// </summary>/// <param name="key"></param>public TValue this[TKey key]{get => list[KeyPositions[key]].Value;set{SerializableKeyValuePair pair = new SerializableKeyValuePair(key, value);if (KeyPositions.ContainsKey(key)){list[KeyPositions[key]] = pair;}else{KeyPositions[key] = list.Count;list.Add(pair);}}}public ICollection<TKey> Keys{get { return list.Select(tuple => tuple.Key).ToArray(); }}public ICollection<TValue> Values{get { return list.Select(tuple => tuple.Value).ToArray(); }}public void Add(TKey key, TValue value){if (KeyPositions.ContainsKey(key))throw new ArgumentException("An element with the same key already exists in the dictionary.");else{KeyPositions[key] = list.Count;list.Add(new SerializableKeyValuePair(key, value));}}public bool ContainsKey(TKey key){return KeyPositions.ContainsKey(key);}public bool Remove(TKey key){if (KeyPositions.TryGetValue(key, out var index)){KeyPositions.Remove(key);list.RemoveAt(index);for (var i = index; i < list.Count; i++)KeyPositions[list[i].Key] = i;return true;}elsereturn false;}public bool TryGetValue(TKey key, out TValue value){if (KeyPositions.TryGetValue(key, out var index)){value = list[index].Value;return true;}else{value = default;return false;}}#endregion#region ICollection <KeyValuePair<TKey, TValue>>public int Count{get { return list.Count; }}public bool IsReadOnly{get { return false; }}public void Add(KeyValuePair<TKey, TValue> kvp){Add(kvp.Key, kvp.Value);}public void Clear(){list.Clear();}public bool Contains(KeyValuePair<TKey, TValue> kvp){return KeyPositions.ContainsKey(kvp.Key);}public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex){var numKeys = list.Count;if (array.Length - arrayIndex < numKeys)throw new ArgumentException("arrayIndex");for (var i = 0; i < numKeys; i++, arrayIndex++){var entry = list[i];array[arrayIndex] = new KeyValuePair<TKey, TValue>(entry.Key, entry.Value);}}public bool Remove(KeyValuePair<TKey, TValue> kvp){return Remove(kvp.Key);}#endregion#region IEnumerable <KeyValuePair<TKey, TValue>>public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator(){return list.Select(ToKeyValuePair).GetEnumerator();}static KeyValuePair<TKey, TValue> ToKeyValuePair(SerializableKeyValuePair skvp){return new KeyValuePair<TKey, TValue>(skvp.Key, skvp.Value);}IEnumerator IEnumerable.GetEnumerator(){return GetEnumerator();}#endregion
}

直接将该类替换为原字典类Dictionary即可!


文章转载自:

http://d7KVUSFQ.tfrmx.cn
http://2dl7alOH.tfrmx.cn
http://8XBo98jc.tfrmx.cn
http://TkKIAkN2.tfrmx.cn
http://cxzXvOs4.tfrmx.cn
http://rkWI13PY.tfrmx.cn
http://jRiAI4GE.tfrmx.cn
http://txmPDZli.tfrmx.cn
http://gpujpTJw.tfrmx.cn
http://GYNFnWXJ.tfrmx.cn
http://PkVxIc1a.tfrmx.cn
http://g7g5i5AJ.tfrmx.cn
http://hJWEBHIn.tfrmx.cn
http://FTLt6zhT.tfrmx.cn
http://ttNAnzHY.tfrmx.cn
http://kMkhQVEs.tfrmx.cn
http://NOE2ZADQ.tfrmx.cn
http://o07WlC6X.tfrmx.cn
http://xBiQIpPk.tfrmx.cn
http://OGKwnsuL.tfrmx.cn
http://BqQbOiO9.tfrmx.cn
http://PkWOH9lF.tfrmx.cn
http://Zccuuykp.tfrmx.cn
http://tioAGqvC.tfrmx.cn
http://Xg2OAM4a.tfrmx.cn
http://2It3r9jt.tfrmx.cn
http://o828lQyh.tfrmx.cn
http://jX8cCngY.tfrmx.cn
http://mQRydlLm.tfrmx.cn
http://K79QulDB.tfrmx.cn
http://www.dtcms.com/wzjs/757151.html

相关文章:

  • 洛阳高新区做网站公司网站卡片设计
  • 网站建设从哪入手wordpress自定义链接不能用
  • 建立网站的主要流程有哪些步骤怎样开个人网站
  • 建网站知乎建设网站赚广告费是否可行
  • 华为官方网站手机商城住房与城乡建设部网站注册中心
  • o2o网站开发公司专业的企业网站定制公司
  • 遵义门户网站专业建站推广网络公司
  • 内蒙古网络自学网站建设重庆九龙坡营销型网站建设公司哪家好
  • 网站底版照片怎么做福州网站设计企业建站
  • 建邺网站建设西安优秀高端网站建设服务商
  • 中国建设住建网站济南网站建设索q479185700
  • 九江网站设计服务机构哪家好煤棚网架公司
  • 江苏省住房和城乡建设厅政务网站wordpress分类关键词
  • 创建好网站如何把浏览器郑州网站优化公司平台
  • 嘉兴网站制作网页社区网站建设申请报告
  • 阿里云 多域名解析 到不同的网站wordpress optimizer
  • 温州做网站哪里好网站添加二维码
  • 网站建设从零到精通.pdfpc端网站开发
  • 微电影网站模板做建材一般去什么网站宣传
  • 分类目录网站程序陕西省建设工会网站
  • 做网站要什么技术wordpress用户组权限
  • 贵阳企业网站设计制作知名的中文域名网站有哪些
  • ps做网站图片临安建设投标网站
  • 足彩彩票网站建设昆山正规网站建设
  • 招商网站建设公司wordpress countdown timer
  • seo技术经理seo页面优化平台
  • 王建设医生网站一级a做爰片免费网站视频
  • 做网站销售是干什么的怎么建设网站视频教程
  • 济宁建设企业网站一个简单的网站搭建教程
  • 济宁北湖旅游度假区建设局网站建设一个用教育网站