.NET Book Zero

A free book from Petzold. What the C or C++ Programmer Needs to Know About C# and the .NET Framework Available in XPS and PDF. http://www.charlespetzold.com/dotnet/index.html

0

Anonymous Methods …

I read Anonymous Methods support in Whidbey (CLR) last week and decided to play with it. This looks a lot like how Javascript (in IE) handles event – <body onload=”msgbox(‘hello’)” ..> In general Anonymous Methods allows code block in place of delegate. For example, public class TestApp: Windows.Application{ protected override void    OnStartingUp(Windows.StartingUpCancelEventArgs e) {  Window win =…

13

Create Assembly in-memory and run it…

This has to do with CodeDom and Microsoft.CSharp namespace. The following code will let you compile and run code in memory, IMHO – perfect for scripting engine needs: using System;using Specialized = System.Collections.Specialized;using Reflection = System.Reflection;using CSharp = Microsoft.CSharp;using CodeDom = System.CodeDom.Compiler; public sealed class TestCompile{ static string ScriptCodeToCompileInMem = “public class Script {public void ScriptExecute(){System.Console.WriteLine(123);}…

5

System.Collections.Generics

I have been starting to use CLR Generics. Absolutely useful for day to day software design and implementation. using Generics = System.Collections.Generics;…private Generics.IList<int> myList = new Generics.List<int>(capacity); myList.Add(100);myList.Add(201);myList.Add(303); The sample above might look very much like ArrayList and it’s being use all over the place. If you compare ArrayList to Generic List, generic list is much much…

1