Last active
August 29, 2015 14:11
-
-
Save imanabu/9a224e796f402a29b9e3 to your computer and use it in GitHub Desktop.
Visual Studio Snips
This file contains 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
<connectionStrings> | |
<add name="myConnectionString" connectionString="Data Source=HOST\INSTANCE;Initial Catalog=myDB;Integrated Security=True" providerName="System.Data.SqlClient" /> | |
</connectionStrings> |
This file contains 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.Configuration; | |
var yn= ConfigurationManager.AppSettings["something"]; | |
<appSettings> | |
<add key="something" value="ofValue"/> | |
</appSettings> |
This file contains 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
private static readonly Logger _logger = LogManager.GetCurrentClassLogger(); |
This file contains 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 path = HostingEnvironment.MapPath("~/blah.config"); |
This file contains 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.Linq; | |
using NUnit.Framework; | |
namespace NUnit | |
{ | |
[TestFixture] | |
internal class BunchOTests | |
{ | |
[Test] | |
public void Test01() | |
{ | |
try | |
{ | |
} | |
catch (Exception ex) | |
{ | |
Assert.Fail("Exception due to {0}", ex); | |
} | |
} | |
} | |
} | |
This file contains 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
return Task.Run(() => Find(param1, param2)); |
This file contains 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
FIRST ADD the applicaton settings section group | |
<configSections> | |
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > | |
<section name="Tools.Instrumentation.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | |
</sectionGroup> | |
</configSections> | |
Then you can copy the complete applicationSettings section into the Web Config as long as the section name matches. In above | |
example, Tools.Instrumentation.Propertis.Settings | |
<applicationSettings> | |
<Tools.Instrumentation.Properties.Settings> | |
<setting name="LogLevel" serializeAs="String"> | |
<value>DEBUG</value> | |
</setting> | |
<setting name="AppName" serializeAs="String"> | |
<value>MyApp</value> | |
</setting> | |
<setting name="Port" serializeAs="String"> | |
<!--value>33333</value--> | |
<value>0</value> | |
</setting> | |
</Tools.Instrumentation.Properties.Settings> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment