Click here to Skip to main content
13,090,426 members (36,323 online)
Rate this:
Please Sign up or sign in to vote.
See more:
In which case static class used we used other why?
Posted 15-Feb-13 22:59pm
Logi Guna 16-Feb-13 14:43pm
You need static class to create extension methods.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

we need static classes when we know that our class will not have any behavior as such. Suppose we have a set of helper or utility methods which we would like to wrap together in a class. Since these methods are generic in nature, we can define them all inside a static class. Remember that helper or utility methods need to be called many times, and since they are generic in nature, there is no need to create instances. E.g., suppose that you need a method that parses an int to a string. This method would come in the category of a utility or helper method.
So using the static keyword will make your code a bit faster since no object creation is involved.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 16 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100