Hi,
I would like to tell you about few Visual Studio add ons that are a must for any developer.
Let's start with the free ones...
1. Test Driven .NET - Let you run any function with a single click No more Main functions for testing your function code just click and go... You can run test, open reflector with a click this is a free download. Trust me it will make you life very easy http://www.testdriven.net/
2. GhostDoc - GhostDoc is a free add-in for Visual Studio that automatically generates XML
documentation comments for C#. Either by using existing documentation inherited
from base classes or implemented interfaces, or by deducing comments from
name and type of e.g. methods, properties or parameters. http://www.roland-weigelt.de/ghostdoc/
3. Resharper - This is add-in is not free but it will save you so much time and energy that will return it cost in less then a week. Great error finder, code optimizer and much more I can write a lot on it but I think you should read more in the site (30 days Trail is available here)
4. Smart paster - let you paste any thing you want as a comment, string, StringBuilder or Region. very nice and easy to use adds another option at the right click menu (download from here)
Enjoy
Wednesday, April 30, 2008
Friday, April 25, 2008
At last HashSet in .NET 3.5
Hi
A few days ago I found a new collection HashSet (System.Collections.Generic namespace).
I am personally waited for this since I first saw it in JAVA 1.4.2.
HashSet is a combination betwin a Set and A Dictionary. Each element can be found only once. Add, Remove, Contains In O(1) - expected (if no rehash is required) just like Dictionary.
It has some new cool methods like UnionWith, IntersectWith.
Small (and simple) Exmaple:
HashSet<int> theSet1 = new  HashSet<int>();
theSet1.Add(1); // Return true
theSet1.Add(2); // Return true
theSet1.Add(2); // Return false
// theSet1 contains 1,2
HashSet<int> theSet2 = new HashSet<int>();
theSet2.Add(1); // Return true
theSet2.Add(3); // Return true
theSet2.Add(4); // Return true
// theSet2 contains 1,3,4
theSet1.UnionWith(theSet2);
// theSet1 contains 1,2,3,4
theSet1.IntersectWith(theSet2);
// theSet1 contains 2
class OddEvenComparer : IEqualityComparer {
public OddEvenComparer() {}
public bool Equals(int x, int y) {
return (x & 1) == (y & 1);
}
public int GetHashCode(int x) {
return (x & 1);
}
}
// Now we will use the comperator
HashSet<int> oddEvenSet= new HashSet<int>(new OddEvenComparer());
oddEvenSet.Add(1); // Return true
oddEvenSet.Add(3); // Return false (we allready have an odd number)
oddEvenSet.Add(4); // Return true
// oddEvenSet will now hold 1,4 (3 is equal to 1 accurding to our OddEvenComparer)
For more information about HashSet you can read in the MSDN http://msdn2.microsoft.com/en-us/library/bb359438.aspx
For Set definition from Wikipedia: http://en.wikipedia.org/wiki/Set
Enjoy
A few days ago I found a new collection HashSet
I am personally waited for this since I first saw it in JAVA 1.4.2.
HashSet is a combination betwin a Set and A Dictionary
It has some new cool methods like UnionWith, IntersectWith.
Small (and simple) Exmaple:
theSet1.Add(1); // Return true
// theSet1 contains 1,2
HashSet<int> theSet2 = new HashSet<int>();
theSet2.Add(1); // Return true
theSet2.Add(3); // Return true
theSet2.Add(4); // Return true
// theSet2 contains 1,3,4
theSet1.UnionWith(theSet2);
// theSet1 contains 1,2,3,4
theSet1.IntersectWith(theSet2);
// theSet1 contains 2
- Unlike ICollection
.Add : void In HashSet.Add : bool
class OddEvenComparer : IEqualityComparer
public OddEvenComparer() {}
public bool Equals(int x, int y) {
}
public int GetHashCode(int x) {
}
}
// Now we will use the comperator
HashSet<int>
oddEvenSet.Add(1); // Return true
oddEvenSet.Add(3); // Return false (we allready have an odd number)
oddEvenSet.Add(4); // Return true
// oddEvenSet will now hold 1,4 (3 is equal to 1 accurding to our OddEvenComparer)
For more information about HashSet
For Set definition from Wikipedia:
Enjoy
Subscribe to:
Posts (Atom)