-
Concurrent Programmers Speaking a New Language
-

Learn C? and write correct Conncurrent Programs easier. C? is a research language written as an extension to C#. For more details check out the following link at Microsoft Reasearch Web Site:
Concurrent Programmers Speaking a New Language
-
C # Language Design :: Default Constrcutor for Structure
-
One of my colleagues mentioned that one can not add a default constructor to a structure definition. I tried that out and found that to be true. I believe it was a language design decision to have left out a default constructor from structure ADT (Abstract Data Type). But it is not a consistent design i believe, classes have default constructors so should the case be with structures. Following is the code snippet that i tried
using
System;
using
System.Collections.Generic;
using
System.Text;
namespace
DefaultConstructor
{
struct MyStructure
{
int i;
public void PrintMyValue()
{
Console.WriteLine(" My value is " + i.ToString());
}
public MyStructure(int iValue)
{
i = iValue;
}
public MyStructure()
{
Console.WriteLine(" I am default Ctor ");
}
}
class Program
{
static void Main(string[] args)
{
MyStructure myStruct;
//myStruct = new MyStructure(12);
myStruct =
new MyStructure();
myStruct.PrintMyValue();
Console.ReadLine();
}
}
}