c# GC 新典型
2024-09-18 05:32:53
public class testGC : MonoBehaviour
{
class XDict<K, V>
{
public void TryGetValue(K key, V value)
{
if(key == null) //产生 GC-ALLOC,因为实参为int,而 null是引用类型,发生了装箱操作
{
}
}
} XDict<int, string> mDict = new XDict<int, string>(); void Start()
{
} void Update()
{
var key = ;
if (key != null) //不会产生GC-ALLOC
{
var value = ;
} mDict.TryGetValue(, "hello");
}
}
最新文章
- servlet jsp jdbc bootstrarp mvc分层模式实现的第一个项目
- js事件代理(委托)
- css中的display以及position属性
- 【转】Fiddler的基本介绍
- [开发笔记]-使用jquery获取url及url参数的方法
- 你有没有试过“闭上眼”使用:京东、滴滴、QQ、支付宝?
- UVA 658 It&#39;s not a Bug, it&#39;s a Feature! (最短路,经典)
- 【C#学习笔记】Dictionary容器使用
- topcoder算法练习3
- BZOJ 1011 [HNOI2008]遥远的行星
- 清除大文本中的html标签
- 转载:struts标签<;s:date>;的使用
- 超过lua上帝的语言
- 工欲善其事,必先利其器之open live writer写作
- [译]ASP.NET Core 2.0 机密配置项
- windows NLB实现MSSQL读写分离--从数据库集群读负载均衡
- Android 推送和统计最优轮循(心跳策略)探究实践
- Task.Wait and “Inlining”
- python模块部分----模块、包、常用模块
- try、catch、finally详解,你不知道的异常处理