更新时间:2022-02-14 05:10:16
就个人而言,我对不太热衷了
超越既定的的TryParse参数
约定。我preFER返回一个封装不同的参数,因为它使code更容易阅读海事组织特定类型的实例。
Personally, I am not too keen on out
parameters beyond the established TryParse
convention. I prefer to return an instance of a specific type that encapsulates the different parameters, as it makes the code much easier to read imo.
如果您不想定义特定的类型,你可以使用的在即将到来的.NET架构元组类型。元组基本上都是一堆包裹在一个类型的值。它们都采用了大量的例如F#。
If you don't want to define specific types for this, you can use the Tuple type in the upcoming .NET framework. Tuples are basically a bunch of values wrapped in a type. They are used a lot in e.g. F#.