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
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration> | |
<configSections> | |
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> | |
</configSections> | |
<startup> | |
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | |
</startup> | |
<log4net> | |
<appender name="UdpAppender" type="log4net.Appender.UdpAppender"> |
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 qry = Foo.GroupJoin( | |
Bar, | |
foo => foo.Foo_Id, | |
bar => bar.Foo_Id, | |
(x,y) => new { Foo = x, Bars = y }) | |
.SelectMany( | |
x => x.Bars.DefaultIfEmpty(), | |
(x,y) => new { Foo=x.Foo, Bar=y}); |
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
You can try json.net library to solve your issue | |
[JsonFilter(Param = "attributes", JsonDataType = typeof(AttributeViewModel[]))] | |
public JsonResult Save(AttributeViewModel[] attributes) | |
At client: | |
$.ajax({ | |
type: 'POST', | |
url: url, | |
async: true, |
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
# Add an enum with All constant | |
Add-Type -TypeDefinition @' | |
using System; | |
[Flags] | |
public enum EnumSample | |
{ | |
One, | |
Two, | |
Three, |
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
Add-Type -TypeDefinition @' | |
using System; | |
[Flags] | |
public enum MyEnum | |
{ | |
Option1 = 0x1, | |
Option2 = 0x2, | |
Option3 = 0x4, | |
All = Option1 | Option2 | Option3 |
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
@powershell.exe -NonInteractive -ExecutionPolicy Bypass -NoProfile -File "%~dp0\SetupComplete.ps1" |
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
$funky = '010500000000000515000000AA7045F3F11474788C4A5F8AE9030000' | |
try | |
{ | |
$bytes = [byte[]]@( | |
for ($i = 0; $i -lt $funky.Length - 1; $i += 2) | |
{ | |
[byte]::Parse($funky.Substring($i, 2), [System.Globalization.NumberStyles]::AllowHexSpecifier) | |
} | |
) |
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
function ConvertTo-Hashtable | |
{ | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true, ValueFromPipeline = $true)] | |
[psobject[]] $InputObject | |
) | |
process | |
{ |
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
# Import the stuff you'll be testing. Could be dot-sourcing a ps1 file here, importing a module, whatever you need. | |
# If importing a mdoule, make sure you've only got one copy of it imported, or weird things can happen when you start | |
# to get into mocking. | |
Remove-Module [S]omeDscResource | |
Import-Module $PSScriptRoot\SomeDscResource.psm1 | |
# All of the Pester tests in a script must go inside a Describe block; you can mave many Describe blocks in the same | |
# script, if you like. Make sure to put the opening brace on the same line as Describe, since this is just a function | |
# pretending to be a keyword; no assistance from the parser allowing us to put opening braces on their own lines. |
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
// based on http://robrelyea.wordpress.com/2007/02/10/winforms-xaml/ | |
// converted to an Extension Method by @CADbloke | |
// a list: http://msdn.microsoft.com/en-us/library/ms750559(v=vs.110).aspx | |
// here's moar code:http://wf2wpf.codeplex.com/SourceControl/latest but it converts source files, not actual controls. | |
// Here's a site that does code too http://www.win2wpf.com/ | |
// http://www.codeproject.com/Articles/25795/Creating-the-Same-Program-in-Windows-Forms-and-WPF | |
// ReSharper disable SpecifyACultureInStringConversionExplicitly | |
using System; |
NewerOlder