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
// log an object to the browser console | |
console.log({ text: "foobar" }); |
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 static IList<T> AutoPopulate<T>(uint numberofItem) where T : class | |
{ | |
var constructorInfo = typeof (List<>).MakeGenericType(typeof (T)).GetConstructor(Type.EmptyTypes); | |
if (constructorInfo != null) | |
{ | |
var listInstance = (IList<T>)constructorInfo | |
.Invoke(null); | |
var rnd = new Random(); | |
for (int ii = 1; ii < numberofItem; ii++) | |
{ |
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
namespace DBB.Plugins.Interfaces | |
{ | |
public interface IPlugin | |
{ | |
/// <summary> | |
/// Gets or sets the plugin's name. | |
/// </summary> | |
string Name { get; } | |
/// <summary> |
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
http://yaxlib.codeplex.com/ | |
YAXLib: Yet Another XML Serialization Library for the .NET Framework |
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
/// <summary> | |
/// Function to get object from byte array | |
/// </summary> | |
/// <param name="_ByteArray">byte array to get object</param> | |
/// <returns>object</returns> | |
public object ByteArrayToObject(byte[] _ByteArray) | |
{ | |
try | |
{ | |
// convert byte array to memory stream |
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
Type That Owns Disposable Fields Implements IDisposable: Good Practice | |
public class OwnsDisposableFields : IDisposable | |
{ | |
private DisposableResource disposableResourceOne; | |
private DisposableResource disposableResourceTwo; | |
// Other fields continue to be declared here. | |
private bool disposed; | |
~OwnsDisposableFields() |
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
//Fill a combobox with an enumerator | |
TypeofItems_cb.Items.Clear(); | |
foreach (var it in Enum.GetValues(typeof(Recipe.ProductType))) | |
{ | |
TypeofItems_cb.Items.Add(it.ToString()); | |
} |
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
String Format for Double | |
// just two decimal places | |
String.Format("{0:0.00}", 123.4567); // "123.46" | |
String.Format("{0:0.00}", 123.4); // "123.40" | |
String.Format("{0:0.00}", 123.0); // "123.00" | |
// max. two decimal places | |
String.Format("{0:0.##}", 123.4567); // "123.46" | |
String.Format("{0:0.##}", 123.4); // "123.4" |
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
/// <summary> | |
/// method to validate an IP address | |
/// using regular expressions. The pattern | |
/// being used will validate an ip address | |
/// with the range of 1.0.0.0 to 255.255.255.255 | |
/// </summary> | |
/// <param name="addr">Address to validate</param> | |
/// <returns></returns> | |
public bool IsValidIP(string addr) | |
{ |
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.Linq; | |
using Pdf_Rendering; | |
using System.IO; | |
using System.Reflection; | |
using System.Xml.Linq; | |
XNamespace namespacexml= "http://www.heidelberg.com"; | |
if (Path.GetExtension(fn).ToLower() != ".xml") { Console.WriteLine("Input file not a pdf file"); return false; } | |
if (!File.Exists(fn)) { Console.WriteLine("Input file does not exist"); return false; } | |
XDocument doc = XDocument.Load(fn); |
OlderNewer