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
{ | |
SaveFileDialog sfd = new SaveFileDialog(); | |
sfd.Title = "Save on XML"; | |
sfd.OverwritePrompt = true; | |
sfd.DefaultExt = "xml"; | |
sfd.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*"; | |
if (sfd.ShowDialog() == DialogResult.OK) | |
{ | |
... |
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
const string REGEX = @"((?<id>\d+)\:)?(?<par1>\d+)\-(?<par2>\d+)\-(?<par3>\d+)(\/(?<par4>\d+)\-(?<par5>\d+))?"; | |
private static Lazy<Regex> g_RegEx = new Lazy<Regex>(() => new Regex(REGEX, | |
RegexOptions.ExplicitCapture | RegexOptions.Compiled | RegexOptions.CultureInvariant)); | |
... | |
Match m = g_RegEx.Value.Match(value); | |
Group gID = m.Groups["id"] as Group; |
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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Net; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Web; | |
using System.Collections.Specialized; |
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
public class CommandsController : ApiController | |
{ | |
[HttpGet][HttpPost][HttpDelete] | |
public void Action1() | |
{ | |
} | |
[HttpGet] | |
[HttpPost] | |
[HttpDelete] |
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
// original source is likely to be https://github.com/thinkpixellab/bot/blob/master/net40-client/Core/LockHelper.cs although I can't verify it anymore. | |
/// <summary> | |
/// Provides services of Monitor static class, but while allowing better debugging of deadlocks. | |
/// </summary> | |
public class LockHelper | |
{ | |
/// <summary> | |
/// Creates a new instance of LockHelper. |
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
// This builds untyped accessors. Remove converts for strong typing. | |
var paramExp = Expression.Parameter(typeof(object), "obj"); | |
var castParamExp = Expression.Convert(paramExp, this.UserDataDescriptor.Type); | |
var propAccess = Expression.Property(castParamExp, PropertyInfo.Name); | |
var castPropAccess = Expression.Convert(propAccess, typeof(object)); | |
var lambda = Expression.Lambda<Func<object, object>>(castPropAccess, paramExp); | |
Func<object, object> getter = lambda.Compile(); | |
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
// Taken from http://social.msdn.microsoft.com/Forums/vstudio/en-US/a43fe625-a5cd-4438-895f-3ddeec6eb866/image-resizing-using-c?forum=csharpgeneral | |
public static System.Drawing.Bitmap ResizeImage(System.Drawing.Image image, int width, int height) | |
{ | |
//a holder for the result | |
Bitmap result = new Bitmap(width, height); | |
//use a graphics object to draw the resized image into the bitmap | |
using (Graphics graphics = Graphics.FromImage(result)) | |
{ |
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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using MoonSharp.Interpreter; | |
namespace PerformanceComparison | |
{ | |
class Sample |
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
public class MyObject | |
{ | |
public int GetSomething() | |
{ | |
return 10; | |
} | |
} | |
[Test] | |
public void MetatableExtensibleObjectSample() |
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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using MoonSharp.Interpreter; | |
using MoonSharp.Interpreter.Debugging; | |
namespace Tutorials.Chapters | |
{ |
OlderNewer