This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| delegate TResult Func<T1, | |
| T2, | |
| T3, | |
| T4, | |
| T5, | |
| T6, | |
| T7, | |
| T8, | |
| T9, | |
| T10, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ gem install htty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'sinatra' | |
| get '/all-good' do | |
| [200, [['Set-Cookie', 'foo=bar; baz']], 'Hello World!'] | |
| end | |
| get '/huh' do | |
| [404, 'What?'] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source 'http://rubygems.org' | |
| gem 'rake' | |
| group :development do | |
| gem 'autotest' | |
| gem 'autotest-fsevent' | |
| gem 'ruby-debug' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Unfortunately, this isn't possible. | |
| using (var sim = new OpenNETCF.Phone.Sim.Sim()) | |
| { | |
| // Use the 'sim' variable ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var sim = new OpenNETCF.Phone.Sim.Sim(); | |
| try | |
| { | |
| // Use the 'sim' variable ... | |
| } | |
| finally | |
| { | |
| sim.Close(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using (var disposer = new Disposer<OpenNETCF.Phone.Sim.Sim>(new OpenNETCF.Phone.Sim.Sim(), "Close")) | |
| { | |
| // Use the 'disposer.Object' property ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // (Do this up front somewhere else.) | |
| var closeMethod = typeof(OpenNETCF.Phone.Sim.Sim).GetMethod("Close"); | |
| // (Do this many times.) | |
| using (var disposer = new Disposer<OpenNETCF.Phone.Sim.Sim>(OpenNETCF.Phone.Sim.Sim(), closeMethod)) | |
| { | |
| // Use the 'disposer.Object' property ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Diagnostics; | |
| /// <summary> | |
| /// Serves as a wrapper around objects that require disposal but that do not | |
| /// implement <see cref="System.IDisposable"/>. | |
| /// </summary> | |
| /// <typeparam name="T">The type of <see cref="Object"/></typeparam> | |
| public abstract class DisposerBase<T> : IDisposable | |
| { |