Skip to content

Instantly share code, notes, and snippets.

View sergiopereira's full-sized avatar
🏠
Working from home

Sergio Pereira sergiopereira

🏠
Working from home
View GitHub Profile
// Instead of writing:
// if( a == "abc" || a == "xyz" || a == "123" ) { ... }
// if( opt != Options.Opt1 && opt != Options.Opt2 && opt != Options.Opt3 ) { ... }
// We can write:
// if( a.OneOf("abc", "xyz", 123") ) { ... }
// if( opt.NoneOf(Options.Opt1, Options.Opt2, Options.Opt3) ) { ... }
public static class ObjectExtensions
{
public static bool OneOf<T>(this T self, params T[] values)
@sergiopereira
sergiopereira / HandyVSMacros.vb
Created June 7, 2009 04:10
Visual Studio Macros that I often use
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Imports System.Windows
Imports Microsoft.Win32
@sergiopereira
sergiopereira / HandyVSMacros.vb
Created June 7, 2009 04:07
Visual Studio Macros that I often use
Public Sub ImportPresentationMode()
DTE.ExecuteCommand("Tools.ImportandExportSettings", "-import:""C:\somepath\Presentation.vssettings""")
End Sub
Public Sub ImportGenericEnvironment()
DTE.ExecuteCommand("Tools.ImportandExportSettings", "-import:""C:\somepath\normal.vssettings""")
End Sub