CodeKeep C# Feed Maggio 5th, 2008
Description: Parse a delimited text file into a list
Link: http://www.codekeep.net/snippets/ad44f11b-e00a-4bfa-9d61-ba360cf6b8ba.aspx
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO; //System.IO is not used by default
public List<string[]> parseCSV(string path)
{
List<string[]> parsedData = new List<string[]>();
try
{
using (StreamReader readFile = new StreamReader(path))
{
string line;
string[] row;
while ((line = readFile.ReadLine()) != null)
{
row = line.Split(',');
parsedData.Add(row);
}
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
return parsedData;
}

CodeKeep C# Feed Maggio 5th, 2008
->
CodeKeep C# Feed Maggio 5th, 2008
CodeKeep C# Feed Maggio 5th, 2008
Description: Use LINQ to read
Link: http://www.codekeep.net/snippets/a48cd7ec-e571-4d20-8995-cd35186a8d0e.aspx
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Query;
namespace LinqToText
{
public static class StreamReaderSequence
{
public static IEnumerable<string> Lines(this StreamReader source)
{
String line;
if (source == null)
throw new ArgumentNullException("source");
while ((line = source.ReadLine()) != null)
{
yield return line;
}
}
}
class Program
{
static void Main(string[] args)
{
StreamReader sr = new StreamReader("TextFile.txt");
var t1 =
from line in sr.Lines()
let items = line.Split(',')
where ! line.StartsWith("#")
select String.Format("{0}{1}{2}",
items[1].PadRight(16),
items[2].PadRight(16),
items[3].PadRight(16));
var t2 =
from line in t1
select line.ToUpper();
foreach (var t in t2)
Console.WriteLine(t);
sr.Close();
}
}
}

CodeKeep C# Feed Maggio 5th, 2008
Description: This is well known by many but took me a while to discover when new to C#. There quite a list in the enumeration of special folders
Link: http://www.codekeep.net/snippets/5203acc2-8e47-4972-ac6f-3fc4e85b514f.aspx
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
Environment.GetFolderPath(Environment.SpecialFolder.System);
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

WebReference News Maggio 5th, 2008
In part 4 of the series, we defined the appearance of our autocomplete control using an external cascading style sheet (CSS). This week we’ll create a JavaScript file to manage the behavior of the autocomplete control in the browser. By Rob Gravelle. 0501