home ‣ C# essentials

13 Mar 2008 · Tags: c#, .net ← newer • 122 of 588older →

C# essentials.

Type size
Byte 1 (unsigned)
Char 2
Bool 1
Sbyte 1 (signed byte)
Short 2 == Int16
Ushort 2 == UInt16
Int 4 == Int32
Uint 4 == UInt32
Float 4 == Single
Double 8
decimal 16 == Decimal
Long 8 == Int64
Ulong 8 == UInt64

types: bool, int, short, double, string, Char, null

enum {}

struct {}

const

classes: Boolean, String, Hashtable, ArrayList

Arrays:
  int[] foo = new int[58];

List<int> il = new List<int>(); 
IEnumerable

public class Foo {
  public string Name { get; set }
  public override string ToString() { return this.Name; }
  public override bool Equals(object obj) { return this.GetHashCode().Equals(obj.GetHashCode); }
  public override int GetHashCode() { return this.Name.GetHashCode(); }
}

if (a > 5) {}
foreach (var val in list) { }
do { } while();

.ToArray()
.ToString()

throw new ArgumentNullException("source");

using System.Collections;
using System.Collections.Generic;

System.Text.StringBuilder
System.Text.RegularExpressions
     
byte[] chars;
string str = Encoding.ASCII.GetString(chars);
string str = Encoding.Unicode.GetString(chars);
byte[] chars = Encoding.ASCII.GetBytes(str);

int i = Int32.Parse(str);
double d = Double.Parse(str);
Boolean, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64, SByte, Decimal, Single, Double

ArrayList
  .Count
  []

Hashtable
  .Add(object key, object value) =>
  .Count => int
  []

System.Diagnostic.Debug
  .Assert(bool cond)

System.Windows.Forms
  Control
  Font DefaultFont
  Point MousePosition

event MouseEventHandler MouseMove

ListBox : ListControl : Control : Component

int IndexFromPoint(Point)

int IndexFromPoint(Int32, Int32)

DockPanel

TextBlock Dock:Top Text Binding Baseline

ListBox ItemsSource Binding IsSynchronizedWithCurrentItem True

FileSystem watcher: http://www.blackwasp.co.uk/FileSystemWatcher.aspx

blog comments powered by Disqus