I've read from many places that static methods are faster than instanced methods anyway.
I use em ALL the time.
For example... say I have a class "Customer" and I want to add a new customer to the DB. I have a static void method "Add" on customer and pass in the customer object's reference and a reference to the currently opened DB connection.
Something like:
Code:
Customer cust = new Customer();
cust.FirstName = "Blah";
cust.LastName = "Blah";
...
Customer.Add(ref cust, ref dbConn);
The only time you need to worry about threading issues is when you make static fields. If you make static methods and pass what you need into them, there won't be any threading issues.
You can test this out by making a simple windows app w/ two buttons that calls a function similar to the following:
Code:
public static void Test(int x)
{
System.Diagnostics.Debug.WriteLine("x = " + x.ToString());
Thread.Sleep(10000); //Sleep 10 seconds
System.Diagnostics.Debug.WriteLine("x = " + x.ToString());
}
Click the first button, which passes in a certain x value, and do the same with the second button a few seconds later.
You'll see the methods retain their values.
If you did something as shown below and referened THAT x instead, then the values would be overwritten.
Code:
public class Test
{
public static int x;
public Test(){}
...
}
But yeah, using static methods is perfectly fine, and from what I've read, even better than calling instanced methods.