Archive

Posts Tagged ‘Static’

Code Issues – Member can be static

October 18th, 2012 Comments off

Cause:

Static members are part of a type and non-static members are part of an instance of that type. If you want to have a shared state or a function between different instances of the same type, a static member will be helpful. This code issue informs you about an instance member that can be converted into a static member.

Read more…

Code Issues hints for types and members

September 28th, 2012 Comments off

Here are the suggestions (hints) code issues which might improve the readability, clarity and performance of your source code.

Read more…

Refactorings to convert between static and instance members

October 31st, 2011 Comments off

Classes allow you to create instance members and static members. Instance members are available when an instance of the class is created and have access to the object’s data. Static members do not require an object created and can be called directly.

Static methods are useful when creating functions that are not reliant on any instance of a class. An example of the extensive use of static members is the System.Math class, which is a library of mathematical functions and constants provided by the .NET framework.

Read more…

CodeRush code issues specific to constructors

September 29th, 2011 Comments off

A constructor is a special class member that is executed when a new object is created. There are two types of constructors: instance constructors and static constructors. Instance constructors are used to create and initialize instances of classes or structures. A static constructor is used to initialize a class itself. A static constructor is called automatically to initialize the class before the first instance is created or any static members are invoked.

Read more…

Code Issues specific for static classes

June 23rd, 2011 Comments off

A static class can be used as a unit of organization for sets of utility functions that operate on input parameters and do not have to get or set any internal data. These functions can be accessed without creating an instance of the class. In this case, a static class can make your implementation simpler and faster because you do not have to create an object in order to call its methods.

Read more…