Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
C#のこのビットに相当するF#は何でしょうか。
public T GetNewItem() { return new T(); }
さらに、outまたはrefパラメーターを必要とする.Netライブラリで使用するために、新しいT()をrefセルとしてどのように返しますか?
私はこれがうまくいくのと同じくらい簡単なことだと思います:
let getNewItem() = new 'T()
デフォルトのコンストラクター制約を推測します。
let mutable d = getNewItem() //d inferred to be System.DateTime DateTime.TryParse("1/1/2011", &d)