Implementing an Implicit Conversion With C# 7.0 Deconstructors

,

While the deconstruct syntax is interesting for its convenience in assigning to a set of variables, what I believe has far broader implications is its potential to provide an “implicit conversion operator” and in a syntax that, quite frankly, is far easier to recall than the implicit cast operator.  For example, I can provide deconstructors that map to a string (the full path), a FileInfo, and a DirectoryInfo:

 

Alas, at least at this time, this doesn’t work.

Leave a Reply

Your email address will not be published. Required fields are marked *