请教一下: 对于大size的类,基本上是reference type,也就是说,这样的一个变量实际上是一个引用。 如果是这样,用不用ref在性能上好像没什么区别?下面是一本书上抄来的: In C#, all parameters are passed by value unless we specifically say otherwise. However, we need to be careful in understanding the implications of this for reference types. Since reference type variables only hold a reference to an object, it is this reference that will be copied, not the object itself.
像我要处理几M的文本文件时就是用ref,调用函数才七八次时间差了好几倍。
对于大size的类,基本上是reference type,也就是说,这样的一个变量实际上是一个引用。
如果是这样,用不用ref在性能上好像没什么区别?下面是一本书上抄来的:
In C#, all parameters are passed by value unless we specifically say otherwise. However, we need to be careful in understanding the implications of this for reference types. Since reference type variables only hold a reference to an object, it is this reference that will be copied, not the object itself.