Variable number of arguments without boxing the value-types?
问题 public void DoSomething(params object[] args) { // ... } The problem with the above signature is that every value-type that will be passed to that method will be boxed implicitly, and this is serious performance issue for me. Is there a way to declear a method that accepts variable number of arguments without boxing the value-types? Thanks. 回答1: You can use generics: public void DoSomething<T>(params T[] args) { } However, this will only allow a single type of ValueType to be specified. If