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
// https://youtu.be/vTnlFdRf1Kc | |
var martinFowler = new Person(10, "Martin Fowler); | |
var server = new DemoDiscountServer(person); | |
var book = new Book("Design Patern", new List<Person>{martinFowler}); | |
var discountApplications = server.GetDiscountAmounts(10, new DiscountContext(book)) | |
public interface IDiscount |
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
[ | |
{ | |
"CO": "ABW", | |
"CountryName": "Aruba", | |
"TwoLettersCode": "AW" | |
}, | |
{ | |
"CO": "AFG", | |
"CountryName": "Afghanistan", | |
"TwoLettersCode": "AF" |
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 void SetValue(Language language, XmlReader reader, string name) | |
{ | |
// Note: Not yet tested! | |
var path = name.Split('/'); | |
var currentType = typeof(Language); | |
// get 1st prop => General -> General/Title | |
System.Reflection.PropertyInfo propInfo = currentType.GetProperty(path[0]); // if Name/type then -> Name | |
for (int i = 1; i < path.Length; i++) | |
{ | |
propInfo = propInfo.DeclaringType.GetProperty(path[i]); |
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 method is written to fix Subtitle Edit's GetRegExContextMenu(Combobox/TextBox) nightmare | |
// make more sense as an extension method. | |
public static Action<TControl, string> BuildContextMenuRegex<TControl>() | |
{ | |
var setMethod = typeof(TControl).GetProperty("SelectedText").GetSetMethod(); | |
var instanceParam = Expression.Parameter(typeof(TControl), "instance"); | |
var regexTokenParam = Expression.Parameter(typeof(string), "regexToken"); | |
var lambaExp = Expression.Lambda<Action<TControl, string>>(Expression.Call(instanceParam, setMethod, regexTokenParam), instanceParam, regexTokenParam); | |
return lambaExp.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
using System.Security.Cryptography; | |
using System.Text; | |
namespace Snippets | |
{ | |
public static class SHA1Util | |
{ | |
/// <summary> | |
/// Compute hash for string encoded as UTF8 | |
/// </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
Unicode table - List of most common Unicode characters * | |
* This summary list contains about 2000 characters for most common ocidental/latin languages and most printable symbols but not chinese, japanese, arab, archaic and some unprintable. | |
Contains character codes in HEX (hexadecimal), decimal number, name/description and corresponding printable symbol. | |
What is Unicode? | |
Unicode is a standard created to define letters of all languages and characters such as punctuation and technical symbols. Today, UNICODE (UTF-8) is the most used character set encoding (used by almost 70% of websites, in 2013). The second most used character set is ISO-8859-1 (about 20% of websites), but this old encoding format is being replaced by Unicode. | |
How to identify the Unicode number for a character? | |
Type or paste a character: |