RcBuilder@walla.com
call centre: 054-5614020

TPL – C# Task Parallel Library

Posted by: RcBuilder  /   Category: Multi Threads / Parallelism / SOURCE CODE / TPL   /   No Comments
26
Jan
2016

TPL - C# Task Parallel Library advantages: 1. heavy actions do not stuck the UI due to the using of another thread and maybe even a different core a good example for this phenomenon is when working with winForms and perform an heavy task - the UI is not responsive 2. an abstraction that built on top of the.

Read more

override static methods

Posted by: RcBuilder  /   Category: OOP / override / SOURCE CODE / Static   /   No Comments
26
Nov
2014

override static methods // a static method belong to the instance of the type itselt (ChildA, ChildB etc.) public class TEST { public class Base { public static string Fun() { return "Base"; } } public class ChildA : Base{} public class ChildB : Base { public static string Fun() { return "ChildB"; } } } USING string a1 = TEST.ChildA.Fun(); // Base string a2 = TEST.ChildB.Fun(); //.

Read more

Is Search Engine Bot

Posted by: RcBuilder  /   Category: HttpContext / HttpRequest / List / Reference Types / Search Engines / SEO / SOURCE CODE / UserAgent   /   No Comments
16
Nov
2014

Is Search Engine Bot public static bool IsSearchEngineBot(System.Web.HttpContext context) { List<string> robots = new List<string>(); robots.Add("googlebot"); robots.Add("spider"); robots.Add("yahoo"); robots.Add("architext"); robots.Add("baidu"); robots.Add("msnbot"); robots.Add("scooter"); robots.Add("slurp"); robots.Add("teoma"); robots.Add("yandex"); try { string userAgent = context.Request.UserAgent.ToLower(); if(userAgent == string.Empty) return false; foreach (string robot in robots) if (userAgent.Contains(robot)) return true; return false; } catch { return false;.

Read more

Write To Event Log

Posted by: RcBuilder  /   Category: Enum / Event Log / SOURCE CODE   /   No Comments
30
Jul
2014

Write To Event Log using System.Diagnostics; // event Log /// <summary> /// Write To Windows Event Log -> Control Panel - administrative Tools - Event Viewer /// </summary> /// <param name="Entry"> /// Message To Write To The Log /// </param> /// <param name="Source"> /// Log Name /// </param> /// <param name="EventType"> /// Error / Information / Warning / Failure / Success /// (enum) EventLogEntryType. /// </param> /// <param name="EventID"> /// Log.

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

basic windows service plus installer c#

Posted by: RcBuilder  /   Category: Installers / Services / SOURCE CODE / System / Timer / Windows Service   /   No Comments
17
Jun
2014

basic windows service plus installer c# Service private System.Timers.Timer timer1; protected override void OnStart(string { this.serviceProcessInstaller1, this.serviceInstaller1}); } void Installer1_AfterInstall(object sender, InstallEventArgs e) { // start service after registration ServiceController service = new ServiceController(this.serviceInstaller1.ServiceName); service.Start(); } notice! use InstallUtil to register the.

Read more

implicit C#

Posted by: RcBuilder  /   Category: Converters / Extensions / implicit / SOURCE CODE   /   No Comments
29
May
2014

implicit C# structure: public static implicit operator Class3(Class1 c); // implicit Convert Class1 to Class3 public static implicit operator Class3(string s); // implicit Convert string to Class3 public static implicit operator string(Class3 c); // implicit class3 to string ... ... example: public class ClassA { public string FName { private set; get; } public string LName { private set; get; } public byte Age { private set;.

Read more

implicit cast to return a single instance object

Posted by: RcBuilder  /   Category: Converters / Extensions / implicit / Reference Types / SOURCE CODE   /   No Comments
29
May
2014

using implicit cast to return a single instance object /* the abillity to return a single instance for multiple objects using implicit cast we defined 2 classes (class1 and class2) and we define 2 services (service1 and service2) each service DoWork method should return a different object type (service1 return class1 and service2 return class2) demand: we want to share it.

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