Wednesday, June 10, 2009
static Vs instance methods
12:38 PM |
Posted by
Sheen |
Edit Post
Perfomance , instance methods are not virtual by default but can be declared as virtual. Virtual method has slightly high overhead than a non virtual method. Static methods are not virtual.
So there might be a slight performance issue and this can be ignored as it's not make much impact on performance.
Choosing your method to be static or instance will depend upon the design. If the method going to be used as an object then it should be an instance method. If it doesn't depend on an instance of an object, it should be static. Static methods belong to a type and instance methods belong to instance of a type.
example
Public Class Car
{
// this is a static method
public static void staticMethod()
{
//your code
}
// this is an instance method
public void instanceMethod()
{
//your code
}
}
Accessing static method
Car.staticMethod();
Accessing instance method
Car car = new Car();
car.instanceMethod();
So there might be a slight performance issue and this can be ignored as it's not make much impact on performance.
Choosing your method to be static or instance will depend upon the design. If the method going to be used as an object then it should be an instance method. If it doesn't depend on an instance of an object, it should be static. Static methods belong to a type and instance methods belong to instance of a type.
example
Public Class Car
{
// this is a static method
public static void staticMethod()
{
//your code
}
// this is an instance method
public void instanceMethod()
{
//your code
}
}
Accessing static method
Car.staticMethod();
Accessing instance method
Car car = new Car();
car.instanceMethod();
Wednesday, June 03, 2009
Deployment Project - Cannot open the file 'ASPNETCOMPILER'
12:23 PM |
Posted by
Sheen |
Edit Post
I got this error when I try to deploy an asp.net web site.
"Cannot open the file 'ASPNETCOMPILER'. The document cannot be opened. It has been renamed,deleted or removed".
The solution is, take your deployment project folder out from the site folder (root).
For example : if your project path is "D:\Projects\Ads" then have the deployment folder in "D:\Projects\Deployment". Don't have the deployment folder in site's folder itself as "D:\Projects\Ads\Deployment".
"Cannot open the file 'ASPNETCOMPILER'. The document cannot be opened. It has been renamed,deleted or removed".
The solution is, take your deployment project folder out from the site folder (root).
For example : if your project path is "D:\Projects\Ads" then have the deployment folder in "D:\Projects\Deployment". Don't have the deployment folder in site's folder itself as "D:\Projects\Ads\Deployment".
Monday, June 01, 2009
32-Bit application on 64-Bit server with IIS7
3:35 PM |
Posted by
Sheen |
Edit Post
Guys, I had to configure a website which is 32 bit, on a 64 bit server with IIS 7. As you know 64 bit servers doesn’t support 32 bit applications but lucky me, IIS has a feature to enable this
It's so easy. In IIs go to Application Pool Right click on your web site and then go to "Advance Settings" , You will get a property called "Enable 32-Bit Applications" change its value to "True". That's all you have to do .
Subscribe to:
Posts (Atom)
Blog Archive
Important Blogs
-
-
BDD with Rails and Cucumber10 years ago
-
-
Watch Live Cricket Online Free14 years ago
-
BBC and Mahinda Rajapakshe15 years ago
-
-