[Journal - Loops, Functions, and Generics in .NET Console]

Loops, Functions, and Generics in .NET Console

Sunday, June 5, 2005

Fire up the latest build of WebEdit, and run the following commands in the Console window:

code:
using System.Collections.Generic
getPaths(history, filter){ret = new List<string>(); foreach(entry in history){if(filter(entry)){ret.Add(entry.FullPath)}} ret;}
isFtp(entry){entry.FullPath.StartsWith("ftp:")}
Dev.TraceCollection(getPaths(WebEditApp.HistoryManager.TotalHistory, isFtp))

You need to have Whidbey Beta 2 installed for the generics to work. Loops and user functions work with all .NET framework versions. User functions are treated like variables, and in WebEdit.NET are listed in the Console window's auto-text list. Read on here for more details on new .NET Console features.

I've also started working on better support for generic types elsewhere in the Gregor.NET framework: