I have large amount of data been passed around in my application as byte[] objects. Which is also turing out to be memory problems in a lot of cases. What about if i wrap byte[] in a class like
[Serializable]
public class MyClass
{
public byte[] Data { get; set; }
}
Do you guys think i would gain any performance becoz now a reference type would be passed around rather a value type ,hence data doesnt have to be copied every time.
Looking forward to your answers
Why should it make an improvement? It can only make things worse. A
byte[]is a reference type itself, not a value type. The effect will be one unnecessary level of indirection and heap allocation for the class.