Skip navigation

Microsoft has added support for Emoji to Windows through the Segoe UI Symbol font. (Microsoft KB2729094 “An update for the Segoe UI symbol font in Windows 7 and in Windows Server 2008 R2 is available”). Unfortunately this does little for us since nobody has the right font in their font stacks.

If you are unfamiliar with Emoji, it is a set of symbols/emoticons (the word Emoji is Japanese for Emoticon). It is used rampantly on Twitter and in other Social Media.

Twitter’s tweet font stack, for example, is: Georgia,”Times New Roman”,serif; so we get this:

capture1

The little square you see there is where the icon should be, but no fonts in the stack have the symbol so it is rendered as “unknown”.

Read More »

The DefaultValue Attribute does NOT actually initialize the field to that value. All it does is indicate what the expected default is.

using System;
using System.ComponentModel;
class MyClass
{
    [DefaultValue(12)]
    public int MyInt { get; set; }
    [DefaultValue(true)]
    public bool MyBool { get; set; }
}
class Program
{
    static void Main(string[] args)
    {
        MyClass myInstance = new MyClass();
        Console.WriteLine(myInstance.MyInt);
        Console.WriteLine(myInstance.MyBool);
        Console.Read();
    }
}

This prints “0″ and “false” because those are the default values for the types: int and bool.

The way to set a default value for an auto-implemented property is in the class constructor.

public MyClass()
{
    this.MyInt = 12;
    this.MyBool = true;
}