Some of my co-workers keep advising me to "just use a static method"
I generally don't use them too often because they are tied to a type and not an instance which usually screws me up when thinking about how to define the base and derived structures.
Are there any penalties or pitfalls to using static methods?
Would something like this even make sense?
This is a simple class of static data that an app calls all over the place, would it be better to make this a non-static method, if so why? (I have about 10 similar classes, the only difference is the data)
I was thinking about refactoring it out to an interface, so that I could easily pass arounf the instances without worrying about the specific type, but then it would have to be derived from Dictionary<Object, Object> to be flexible. Arrrgh, I'm confusing myself
more as I type.
public class SomeData : Dictionary<String, String>
{
public static Dictionary<String, String> GetDictionary()
{
SomeData sd = new SomeData()
{
{"1", "Billy Bob Thorton"},
{"2", "Bob Barker"},
{"3", "Ben Bernanke"}
};
return sd;
}
}
I also did some expirementing and just realized today, that Interfaces can't contain a static definition.
Could someone also explain the reason for that?

Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.