RcBuilder@walla.com
call centre: 054-5614020

Translations class example

Posted by: RcBuilder  /   Category: Controls / Converters / Dictionary / Enum / SOURCE CODE   /   No Comments
06
Nov
2014

Translations class example namespace Translations { public class Months { private Entities.Cultures.eCountryCode DefaultCountry = Entities.Cultures.eCountryCode.EN; private Dictionary<Entities.Cultures.eCountryCode, Dictionary<string, string>> _Data = new Dictionary<Entities.Cultures.eCountryCode, Dictionary<string, string>> { { #region CN: Entities.Cultures.eCountryCode.CN, new Dictionary<string, string> { { "01", "一月" }, { "02", "二月" }, { "03", "三月" }, { "04", "四月" }, { "05", "五月" }, { "06", "六月" }, { "07", "七月" }, { "08", "八月" }, { "09", "九月" }, { "10", "十月" }, { "11", "十一月".

Read more

LINQ – Find vs Single vs First

Posted by: RcBuilder  /   Category: Dictionary / Lambda / Linq / List / Predicate   /   No Comments
12
Oct
2014

LINQ - Find vs Single vs First Find() get an item by primary key. return null if not exists. look in the context before going to the database (EF). Single() get an single item by an expression. throw an exception if not exists or there's more than one. SingleOrDefault() get an single item by an expression. return null if not exists. throw an exception if there's.

Read more

Convert To Dictionary

Posted by: RcBuilder  /   Category: Dictionary / Generic T / Lambda / Linq / List / SOURCE CODE   /   No Comments
05
Oct
2014

Convert To Dictionary using System; using System.Collections.Generic; using System.Linq; class ConvertToDictionary { private List<string> values = new List<string>() { "ROBY", "AVI", "ISSAC", "YOSSI", "IDAN", "SHARON" }; public void ConvertAnonymous() { var res = from item in values select new { MyName = item, item.Length }; Dictionary<string, int> dic = res.ToDictionary(k => k.MyName, k => k.Length); foreach (var keypair in dic) Console.WriteLine(keypair.Key + " = " + keypair.Value); } public.

Read more

C# Indexer

Posted by: RcBuilder  /   Category: Dictionary / Indexer / SOURCE CODE   /   1 Comment
17
Jun
2014

C# Indexer public class ResponseParams { private Dictionary<string, string> _prms = null; public ResponseParams() { _prms = new Dictionary<string, string>(); } public ResponseParams(IEnumerable<KeyValuePair<string, string>> prms) : this() { foreach (var p in prms) _prms = p.Value; } public string this { get { return _prms; } set { if (!_prms.ContainsKey(Name)) // new _prms.Add(Name, value); else // update _prms = value; } } } USING  string s_prms = "result=1&groupsCount=5&size=77"; var res = from param in s_prms.Split('&') let keypair = param.Split('=') select new.

Read more

ToParams – string extension

Posted by: RcBuilder  /   Category: Dictionary / Extensions / Linq / List / Reference Types / SOURCE CODE   /   1 Comment
28
May
2014

ToParams - string extension ResponseParams public class ResponseParams { private Dictionary<string, string> _prms = null; public ResponseParams() { _prms = new Dictionary<string, string>(); } public ResponseParams(IEnumerable<KeyValuePair<string, string>> prms) : this() { foreach (var p in prms) _prms = p.Value; } public string this { get { return _prms; } set { if (!_prms.ContainsKey(Name)) // new _prms.Add(Name, value); else // update _prms = value; } } } Extensions internal static class Extensions { public static ResponseParams ToParams(this string me){ var res = from.

Read more

HttpRuntime Cache with dictionary

Posted by: RcBuilder  /   Category: Cache / Dictionary / Linq / SOURCE CODE   /   2 Comments
04
May
2014

HttpRuntime.Cache with dictionary public Group GetGroupCache(string groupName) { Dictionary<string, Group> groups = null; string CACHE_KEY = "MT4_GROUPS"; if (HttpRuntime.Cache == null) { var temp = GetGroups(); if (temp.Count > 0) { groups = temp.ToDictionary(x => x.Name, x => x); HttpRuntime.Cache.Add(CACHE_KEY, groups, null, DateTime.Now.AddHours(3), TimeSpan.Zero, CacheItemPriority.High, null); } } else groups = (Dictionary<string, Group>)HttpRuntime.Cache; return groups; } // need to implement  Group.

Read more
  • פיתוח מערכות
  • פתרונות טכנולוגים
  • קידום אתרים
  • בניית אתרים