wit-bindgen icon indicating copy to clipboard operation
wit-bindgen copied to clipboard

add resource support to C# generator

Open dicej opened this issue 1 year ago • 0 comments

This adds resource support to the C# generator and also fixes a few miscellaneous issues that were preventing tests from passing.

I believe the code generated for imported resources is reasonably ergonomic, although I'm pretty new to C#, so I'm open to suggestions to make it more idiomatic.

As with other languages, the code for exported resources is a bit less ergonomic, I'm using an interface to represent the API, but I also want implementations to inherit code which manages the resource handle, for which I'm currently using a class. The upshot is that implementing an exported resource involves both extending a class and implementing an interface. Again, I'm open to suggestions about improving this. Note that exporting resources tends to be a lot less common in end-user code than importing them, so we probably don't need to obsess over ergonomics in that case.

dicej avatar Apr 26 '24 20:04 dicej