tihomir ivanov

Hi All,

I learned PHP in only 17 hours and it was absolutely enough to begin work as a PHP developer. Learn More how it can be done.

 

Honestly, I don't like asp.net, php, java, c++, javascript, ruby at all.

So, I Created My Own Powerful Programming Language for a few days.

Learn How it Can Be Done. It's really easy :)

C# Bad Code Examples

Written on August 27, 2010 – 12:28 am | by admin |

After the success of PHP Bad Code Examples, I decided to write another one about bad code examples, but this time it’s about C# Enjoy: Example 1. /// <summary> /// Returns current UTC time /// </summary> /// <returns></returns> public static DateTime GetCurrentTimeUtc() { DateTime dt = DateTime.UtcNow; return dt; } Example 2. bool value; if(value.ToString.Length() [...]

Tags:

Things you probably didn’t know about C# – Part 2

Written on March 4, 2010 – 2:10 am | by admin |

After a post about Things you probably didn’t know about C#, here’s a new post from the series: 1. If you want to exit you app without calling any finalizers or finally blocks use: Environment.FailFast(); 2. Instead of sting filePath = directoryPath + “\” + filename; you can use: sting filePath = System.IO.Path.Combine(directoryPath, filename); 3. [...]

Tags:

public static or static public

Written on February 28, 2010 – 4:34 am | by admin |

Recently, I learned that in PHP and C# declarations like static public or static private are absolutely valid declarations of static methods. You can use both declarations, they has same meaning and there is no recommendation which one should be used: public static function myStaticMethod() or static public function myStaticMethod() But in my practice I [...]

Tags: ,

Things you probably didn’t know about C#

Written on February 25, 2010 – 1:37 am | by admin |

I had some free time today, so I decided to learn something new in C#, here’s list of most interesting things that I learned: 1. Instead of using (Font f1 = new Font(“Arial”, 10.0f)) { using (Font f2 = new Font(“Calibri”, 10.0f)) { //t use f1 and f2 here } } it can be written: [...]

Tags:

Should you create separate file for new enum in .NET?

Written on February 20, 2010 – 5:15 am | by admin |

You may become in the following situation: You have some class and you want to add some enum for it, then you begin wandering should you add a new file for the enum. I think if the enum will be used by a single class then you should add the enum declaration inside the class. [...]

How to declare and init a static Dictionary

Written on February 15, 2010 – 2:14 am | by admin |

You may want to declare a static Dictionary variable in you code, here’s a simple example how it can be done in C#: using System.Collections.Generic; … public static Dictionary<string, string> dict = new Dictionary<string, string>() { {“key 1″, “value 1″}, {“key 2″, “value 2″}, {“key 3″, “value 3″} }; That’s all. It’s similar to the [...]

C# Tips and Tricks

Written on October 20, 2009 – 5:19 am | by admin |

1. Convert a string to a Byte[] array: byte[] string2byteArr = System.Text.UnicodeEncoding.GetBytes(“Some String”); 2. Lazy load something rather than Foo foo; public Foo Foo { get { if (foo == null) { foo = new Foo(); } return foo; } } you can try: Foo foo; public Foo Foo { get { return foo ?? [...]

Tags:

Top C# Programming Mistakes

Written on August 27, 2009 – 11:40 am | by admin |

1.Using String variables: if (someString.Length > 0) { // … } … but someString could be a null: if  (!String.IsNullOrEmpty(someString)) { // much better now !? } 2.String concatenation string s = “dev”; s += “-”; s += “the”; s += “-”; s += “web”; s += “.”; s += “com”; This is not very [...]

Tags: