LINQ to SQL maps the relational database into an object model, and when the program runs the queries in the object model are translated into SQL. SQL contains Aggregate functions like SUM, AVG, MIN, MAX and more. Lets see how this functionality can be implemented using LINQ Enumerable standard aggregation operators. You can also create [...]
Continue Reading...
If you are writing an application that uses font you will find this post very useful. Making a font selecting ComboBox that shows a preview of the fonts in WPF is very easy, here is how to do it:
First we will have to create the ComboBox Code, this is a regular ComboBox we have all [...]
Continue Reading...
It is common knowledge that there is no such thing as software without bugs. There are several bugs out there that are hiding and therefore are not handled at all. We surely don’t want to release a software that will crash ungracefully due to such a case. Fortunately, the .Net framework makes it possible to [...]
Continue Reading...
Recently, I ran into a great free Microsoft tool which is called - Resource Refactoring Tool. This tool provides developers an easy way to extract hard coded strings from the code to resource files.
Resource files (.resx files) consists of XML entries, which specify objects and string inside XML tags. Those files can be opened with [...]
Continue Reading...
We use collections all the time. Many times we have to expose them to users of our classes. Lets look at this simple tree node class:
class TreeNode
{
private List<TreeNode> children = new List<TreeNode>();
public IList<TreeNode> Children
{
[...]
Continue Reading...
According to this site It seems that Yes!
The Linux Project Mono was recently converted to the iPhone platform. Pay close attention that this is only the start but it seem that the day when we will see .NET applications running on iPhones is not far away… The question is will the iPhone still be around [...]
Continue Reading...
Whenever we need to implement an interface in C#, two options pops up (click Ctrl+’.’):
Implicit vs explicit interface implementation, what shall be selected? before making a decision, lets understand what is the difference between those two.
Solving the diamond problem:
The diamond problem is related to object oriented languages that allow multiple inheritance. The problem raises when [...]
Continue Reading...
Finding a good and free domain is not an easy task, and might be a real time consuming. To make it much more efficient and fun, why don’t you do it the web 2.0 way? check out ajaxwhois.com. you can select the preferred extensions and just type in the name you want to check without [...]
Continue Reading...
BinaryReader is a class that reads primitive data types as binary values in a specific encoding (see MSDN for more details). The usage of this class is to read sequences of bytes usually created by reading a file, getting data from sockets and retrieving data from memory. After having the stream of bytes, we may [...]
Continue Reading...
We wanted to check whether WPF data binding is thread safe, and made a little test (using .NET 3.5). Lets look at the Worker class, which has one property - Money, and is making money in a multithreaded way :) - creating 100 threads and increasing the “Money” property from each one of them:
class Worker : INotifyPropertyChanged [...]
Continue Reading...