FSharp.Interop.Dynamic icon indicating copy to clipboard operation
FSharp.Interop.Dynamic copied to clipboard

Is it possible to check if a key exists?

Open pkese opened this issue 1 year ago • 1 comments

I'm getting some unstructured objects and would like to check if o?myProp exists before extracting it?

Does this library allow me to do that somehow?

Currently, when accessing o?myProp, I'm getting:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'System.Object' does not contain a definition for 'myProp'

pkese avatar Mar 11 '24 13:03 pkese

It doesn't look possible using the library today. I guess consider adding a Dyn.exists or Dyn.tryGet?

It looks like the engineering in this repo needs updating too!

dsyme avatar Mar 11 '24 18:03 dsyme