.net - Instantiating types: when using new? -
i have type mapping class in f# follows:
type myclass = val myval: integer new () = { myval = 0; } member self.myval () = self.myval
well, want create instance of class. can so:
let myinstance = myclass ()
or
let myinstance = new myclass ()
what's difference? can both?
for types implements idisposable should instantiated using new. otherwise following compilation warning.
it recommended objects support idisposable interface created using 'new type(args)' rather 'type(args)' indicate resources may owned generated value
Comments
Post a Comment