![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C#
JousonRen
unity开发者,H5爱好者
展开
-
【c#高级编程】数组和元组:通过IComparable接口实现自定义类的数组元素排序
通过IComparable接口实现自定义类的数组元素排序通过继承Icomparable接口实现类排序Array类使用Quicksort算法对数组中的元素进行排序。Sort()方法需要数组中的元素实现Icomparable接口。Icomparable接口只定义了一个方法CompareTo(),如果比较对象相等返回0,如果实例应该排在参数的前面返回小于0的值,否则返回大于0的值示例://自定义类public class Person{ public string FirstName;原创 2020-06-16 23:06:00 · 396 阅读 · 0 评论 -
设计模式-大话设计模式学习笔记
大话设计模式学习笔记原创 2019-09-12 14:05:03 · 316 阅读 · 0 评论 -
Unity内通过百度api实现图片转文字
闲暇时间实现的一个小工具,在Unity引擎通过接入百度api实现打开windows文件资源管理器选择图片转成文本,复制到剪贴板的功能。需要导入System.Windows.Forms的dll和Baidu.Aip.Ocr的dll,并且去百度云申请开通免费的OCR功能主要代码:using System.Collections;using System.Collections.Generic;...原创 2019-08-22 19:00:09 · 1591 阅读 · 0 评论 -
Unity某个向量围绕某个轴旋转多少度
Vector3 newVec = Quaternion.AngleAxis(angle,axis)*oriVecangle:旋转度数axis:围绕哪个轴旋转oriVec:初始向量原创 2018-12-07 14:31:45 · 9078 阅读 · 2 评论 -
C#线程优先级的小问题
网络通信经常用到线程,重新复习一下 代码using System;using System.Threading;namespace ConsoleApp1{ class Program { static void Main(string[] args) { Thread MyThread = new Thread(...原创 2018-07-22 21:20:00 · 730 阅读 · 0 评论 -
C#List混装存储子类和父类对象并进行排序操作
不同的子类在List中是能够正常存储的,但是在存储时都需要以父类型存储进去,即List的类型为父类,而Add()中的类型可以声明为实际使用的类型: ` Prop newProp = new ChildProp(); newProp = prop; //prop为需要add的参数,并且已知prop为子类型ChildProp转换而来 ...原创 2018-02-28 09:57:05 · 3179 阅读 · 0 评论 -
在Unity序列化List<>
在Unity的inspector检视面板中像List这种不会自动序列化的数据结构 在自定义的类或者结构体前加上[System.Serializable] 在自定义的类或者结构体里面的数据前加上[SerializeField]原创 2018-01-10 15:22:10 · 5452 阅读 · 0 评论 -
Unity StartCoroutine 和 yield return
外部链接转载 2017-11-28 10:48:28 · 265 阅读 · 0 评论 -
IEnumerable、GetEnumerator、IEnumerator之间的区别
原帖地址 微软官方解释 一、IEnumerator该接口定义需要实现以下方法:1、Current:获取集合中的当前元素。2、MoveNext:将枚举数推进到集合的下一个元素。3、Reset: 将枚举数设置为其初始位置,该位置位于集合中第一个元素之前。实现以上方法的类也就意味着这个集合类能够被遍历访问。二、IEnumerableable意味着这个类能够达到上面IEnumerator的效果, 事实上转载 2017-11-15 15:22:18 · 1051 阅读 · 0 评论 -
泛型
参考博客c#之泛型详解 参考书籍《c#高级编程》(第七版) 1.性能 泛型在使用的过程中不用装箱和拆箱,更加节省性能。 例如List和ArrayList比较,List实用了泛型了,比ArrayList更加节省性能。 2.类型安全 泛型在使用时就规定了参数的类型,在类型上更加安全,能在编译时发现错误。 3.二进制代码的重用 泛型可以更好的重用二进制代码原创 2017-11-03 14:28:40 · 205 阅读 · 0 评论 -
操作符 ? 和 ??
原帖地址 先看如下代码:string strParam = Request.Params["param"];if ( strParam== null ){ strParam= "";}string strParam= Request.Params["param"] == null ? "": Request.Params["param"];你发现,尽管实现的同一个功能,但第二段代转载 2017-11-15 11:20:31 · 383 阅读 · 0 评论