Archive for the ‘C#’ Category.

Uncommon Collection features : Indexers, Multiple Indexers with Params and yield

Collections are the most used elements in the programs. Indexers helps us to access the elements of a collection. Although you might not have implemented indexers, you have used indexers a lot. Whenever you have an array or a collection object you use indexers.
Implementing indexers is done by coding “this[TYPE]” property. The object implementing the indexer […]

XNA Game Studio Express (Beta) Now Available

I am just downloading it. Download it too. You also need to download Visual Studio C# Express as the documentation says. Also for audio you might need Directx SDK, So downloading all of them.

XNA Game Studio Express
Visual Studio C# Express
Directx SDK (August 2006)

Useful Links
XNA ReadmeXNA Team BlogXNA Forums

Nullable Types - Null-Coalescing Operator ?? in C# .NET 2.0

Nullable types are instances of Nullable structure. This Nullable structure is a generic struct type in base class library. It behaves like value type when it has a value which means that boxing or unboxing occurs. However when it does not have a value, it is null instead of the value types default value, and boxind […]

Reflection with Private Members

By using reflection we can call any function including the private and protected ones. This includes private static methods, constructor methods, normal methods. What we need to do is to get the method by the BindingFlags.Nonpublic flag and then we just use it like a reflected type.

using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
 
namespace ReflectPrivateMembers
{
[…]

XML Class Generator for C# using XSD for deserialization

Let’s say we have an XML file and we want to deserialize that file to our implemented class. This is an easy task if the XML file is simple. However if it has more complex types, it can take a long time to implement the class without error. XSD comes with .Net framework SDK. I […]

The coolest exception I’ve ever get : FatalExecutionError

I get the coolest exception from .Net FatalExecutionError. What is cool for that exception is that it is assuming that itself might be wrong. “This error may be a bug in the CLR.” So I might not be the one who generated, I can just blame CLR for doing that

“The runtime has […]

Value Types vs Reference Types - Boxing Unboxing

In a custom control, I wrote a general function to handle the object equality. I have used it several times without error. However today I sent a value type instead of a reference type, and some unexpected results occured.
The base class object have some basic methods which other classes override those methods. One […]

Windows Communication Foundation - Simple Web Service Call

Invoking web services is not much different in windows communication foundation. We have a tool svcutil that generates the interface and the proxy class automatically, I think this will be included later on the IDE. For this sample call I just used google search service. We use the command svcutil with the wsdl adress of […]

SSCLI has just released

Microsoft source implementation of CLI is on the microsoft site. That code looks really weird, it is really low level
Nice to read indeed the implementation of the language itself.
You can download it from here:
Download SSCLI 2.0