Wednesday, July 28, 2010

Array of Tuples

Q: How would use tuples in C# 4.0 to create an array of tuples containing various types of data (i.e. Employee Name, Employee ID#)?

A: Listed below is a sample code snippet to implement an array of tuples.

//Array of Tuples (i.e. EmpName, EmpIDNum)
Tuple[] EmpRecs =
{
Tuple.Create("Sam Nasr", 891),
Tuple.Create("Jim Smith", 358),
Tuple.Create("Lisa Jones", 962)
};

string FirstEmpName = EmpRecs[0].Item1;

string SecondEmpName = EmpRecs[1].Item1;
int SecondEmpIDNum = EmpRecs[1].Item2;


More information can be found at http://msdn.microsoft.com/en-us/library/dd413854(VS.95).aspx

Tuesday, July 20, 2010

MVVM Resources

Tonight's Cleveland WPF User Group meeting will continue last month's discussion on MVVM. For those who missed June's meeting, the following resources are available to help prepare for tonight's meeting:
• MVVM Overview (June’s Presentation): http://www.clevelandwpf.info/presentations/MVVMOverview.ppt
• MVVM, a WPF UI Design Pattern(17min video): http://channel9.msdn.com/shows/Continuum/MVVM/
• Problems and Solutions with Model-View-ViewModel: http://msdn.microsoft.com/en-us/magazine/ff798279.aspx
• WPF x FileExplorer x MVVM: http://www.codeproject.com/KB/WPF/WPFFileExplorer.aspx

For directions to the Cleveland WPF User Group, please visit www.ClevelandWPF.info