C# ValueTuple with disposable members

Let's say I have a method foo which returns a ValueTuple where one of it's members is disposable, for example (IDisposable, int). What is the best way to make sure the returned disposable object is correctly disposed on the calling side? I tried th...
more »

2017-09-26 14:09 (1) Answers

Can using be used to type alias an array?

I'm not sure I've worded this properly since this is a bit of an odd situation. Basically I've found some code like this: template<class T> struct X { typedef T Type; }; template<class T> struct X<const T[]> { typedef T Type[]; } ...
more »

2017-03-25 07:03 (1) Answers

GC.KeepAlive to preserve a context

I have a class which is is a simple wrapper for WNetUseConnection Here is an implementation (just for reference): internal class RemoteFileSystemContext : IDisposable { private readonly string _remoteUnc; private bool _isConnected; publ...
more »

2016-07-26 15:07 (2) Answers