Had this book on my reading list of a while, but since it is required reading for OU, I thought I would give it a go.
The take aways from don't make me think for me are
- Convention is not all bad
- Accessibility is really a lot of common sense and fringe benefits including potential for increased traffic
- We tend to scan websites for information and do not read it all
- Usability testing is worth while doing and does not have to cost much at all.
- Goodwill can be bought and lost at a rapid rate.
The linq solutions are terse relative to my own explicit solutions.
namespace boredbasics
{
class Program
{
static void Main(string[] args)
{
var aDictionary = new Dictionary<string, string>
{
{"d", "a first value"},
{"z", "a Second value"},
{"a", "a ThirdValue"},
{"n", "a forthValue"}
};
DictionarySorter.PrintDictionary(aDictionary);
Console.WriteLine();
//sorted by key
DictionarySorter.PrintDictionary(DictionarySorter.SortByKey(aDictionary));
Console.WriteLine();
//sorted by value
DictionarySorter.PrintDictionary( DictionarySorter.SortByKey(DictionarySorter.KeyValueSwap(aDictionary)));
Console.WriteLine();
Console.ReadLine();
}
}
}
namespace boredbasics
{
public class DictionarySorter
{
public static Dictionary<string, string>
SortByKey(Dictionary<string, string> aDictionary)
{
return aDictionary.Keys.OrderBy(k => k.ToString()).ToDictionary(key => key, key => aDictionary[key]);
}
public static Dictionary<string, string> KeyValueSwap(Dictionary<string, string> aDictionary)
{
return
aDictionary.Keys.ToDictionary(key => aDictionary[key]);
}
public static void PrintDictionary(Dictionary<string,
string> aDictionary )
{
foreach (var key in aDictionary.Keys)
{
Console.WriteLine("key: {0}, value: {1}", key,
aDictionary[key]);
}
}
}
}
Apart from all of that found a good link on Hanselman's blog for good applications
GitHub for windows and Windows memory tester being news to me, so I will give those an install and see how they go. As using github via the command line does make it a pain to use. Must give linqpad a go.
No comments:
Post a Comment