You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class MyClass{
// Some methods, variables and constructors
public Result<Stream> OpenStream() {
// Implementation
}
}
The only pattern I can think of for handling the returned object is as follows:
var instance = new MyClass(..);
var streamReasult = instance.OpenStream();
if(streamResult.IsFailed){
return Result.Fail<...>(...);
}
try{
// Do my stuff with the stream
}
finally{
streamResult.Value.Dispose();
}
Is there a better way?
The text was updated successfully, but these errors were encountered:
Let us have a class
The only pattern I can think of for handling the returned object is as follows:
Is there a better way?
The text was updated successfully, but these errors were encountered: