Click here to Skip to main content
12,452,721 members (52,176 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
In which case static class used we used other why?
Posted 15-Feb-13 22:59pm
Comments
Logi Guna 16-Feb-13 14:43pm
   
You need static class to create extension methods.
Rate this: bad
 
good
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.
  Permalink  

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 | Mobile
Web02 | 2.8.160826.1 | Last Updated 16 Feb 2013
Copyright © CodeProject, 1999-2016
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