Hey guys
i just have two questions about two methods used in many controllers/servlets in my app:
1-what is the difference between calling a static method in a util class or a non static method (like methods dealing with dates i.e getting current time,converting between timezones), which is better ?
2-what is the difference between call...
I have a static class with a few methods that just take in a byte array, parses it, and returns a structure. I need to call these methods from many separate threads. Do I need a lock() or some kind of thread-safety within the methods? I can't get my head around it.
...
I need to refresh data in GridView after I call static method (Asp.Net, C#).
Is it possible to accomplish it?
...
I started using Resharper and it indicated when a method could be made static. Would converting a few hundred methods to static methods increase the memory footprint over a large period of time?
...
Here is a meaningless extension method as an example:
public static class MyExtensions
{
public static int MyExtensionMethod(this MyType e)
{
int x = 1;
x = 2;
return x
}
}
Say a thread of execution completes upto and including the line:
x = 2;
The processor then context switches and another t...
I just came across code that had protected static class functions, as in:
class C {
...
protected:
static int fun() { ... }
};
I got curious if static class functions could have access modifiers and what would it mean? Since they are class globals and not pre-instance.
Thanks, Boda Cydo.
...
Hello everyone,
In ActionScript 3.
Given some method! Is there a way to get the class that's defining my method (at runtime).
Furthermore the method is static.
Looked at http://www.as3commons.org/ but doesn't seem to find what I'm looking for.
...
I have a general question...when should i be using static classes or static methods?..
I know the idea that static methods can be called without instantiating...and static classes should only be used for static methods?...but are there any performance concerns also with it...and when should they be preferred over instance methods and cla...
Hi,
I am interacting with an API that just has static functions, and cannot be opened up and changed.
public class WindowsNativeGraphAPI
{
public static IEnumerable<IGraphData> GetGraphData();
public static bool DeleteGraphData(IGraphData data);
}
I would like to be able to pass the API into a function or ...
Of course, the following doesn't work in Java (no abstract static methods)...
public abstract class Animal {
public abstract static Animal getInstance(byte[] b);
}
public class Dog extends Animal {
@Override
public static Dog getInstance(byte[] b) {
// Woof.
return new Dog(...);
}
}
public class Cat ext...
I am attempting to build a generic XMLLoader class with a static LOAD method, with the intent to use it as follows...
private var _data:XML = XMLLoader.LOAD("path/to/xml_file.xml");
Then I could use it in any client and go-to-town with e4x.
The general problem I am having is with the URLLoader's COMPLETE event, which necessarily cal...
I am trying to decorate the magic method __getitem__ to be a classmethod on the class. Here is a sample of what I tried. I don't mind using either classmethod or staticmethod decoration, but I am not too sure how to do it. Here is what I tried:
import ConfigParser
class Settings(object):
_env = None
_config = None
def __init_...
In my application which have a lot of viewcontroller classes as well as tableviewcontroller classes in all classes i want to show navigationcontroller which have
//creation of toolbar
UIToolbar *tool = [UIToolbar new];
tool.frame = CGRectMake(0, 0, 320, 42);
//create setting button
UIButton *bttn=[[UIButton alloc]initWithFrame:CGRectMak...
Hello there,
I'm wondering if is there any way to mimic the same behaviour we have for top level classes in AS3 for example:
var myArray:Array = [1,2,3,4];
trace(myArray) // [1,2,3,4];
As you can see it returns the own object when tracing it.
but if I create my own class that extends Array I get
var queue:Queue = new Queue([1,2,3,4]...
I have a number of data classes, which share an abstract base class so i can work with them generically (sort of). They each have a static method called Lerp, which i use frequently along with a couple of other lines. I wanted to refactor this out into a method because of DRY,but it seems there's no way to do so. How do i get around this...
I've created my own custom pseudo enumerations within my domain model to allow me to have some more verbose values. For example, my class is as follows:
public abstract class Enumeration<X, Y> : IComparable where X : IComparable
{
public Enumeration(X value, Y displayName) { }
public Y DisplayName { get { return _displayName; ...
I have a question about the variables inside the static method.
Does the variables inside the static method shares the same memory location or would the have separate memory?
Let me make an example.
public class XYZ
{
Public Static int A(int value)
{
int b = value;
return b;
}
}
If 3 different user calls exec...
I need to create a set of static classes and all of them need to implement the same methods. I want to find a way to force them so.
I understand that static classes cannot derive anything other than System.Object. Should I use non-static methods for this? It could be, but none of the methods of this class will use instance properties......
Hi all,
I'm interested in objective analysis of which is more performant; calling instance methods of a singleton class or methods of a static class. I've already seen this so I'm not looking for a discussion about the difference between the two or a discussion of which is "better." I'm only interested in relative performance between t...
I have the following class:
public class DocketType : Enumeration<DocketType, int, string>
{
public static DocketType ChangeOver = new DocketType(1, "Changeover");
public static DocketType Withdrawal = new DocketType(2, "Withdrawal");
public static DocketType Installation = new DocketType(3, "Installation");
private Doc...