I was asked a question in an interview and i wasn't able to answer it... Here is the question
How will you define an instance[c#]?
My answer was it is an other name of an object... what is the right answer for this question...
...
Why does NSClassFromString return nil ? As per the definition it has to return class name.
How should i take care to rectify this problem. since i need to instantiate a class from string and call the method which is in the class using the instance created.
This is how my code looks like.
id myclass = [[NSClassFromString(@"Class_from_St...
I need to have an algorithm that can get the object a method within the method like this:
public class Class1 {
public void Method () {
//the question
object a = ...;//the object that called the method (in this case object1)
//other instructions
}
}
public class Class2 {
public Class2 () {
...
Is it possible using reflection to get THE instance of the class of a calling method?
Trying to "hack" a solution for webservices to pass on the Timeout value of the incoming call (When you call a webservice that in turn calls a new webservice using WSE. It sucks when the client sets a timeout of 5 mins and the next level only have the ...
Is it possible to compile movieclips to swc with the instance name as property name? This happends when I add a dynamic text field, but i would like this also on some UI elements.
...
I have a C# method which creates a new instance of a class from a string, however, I get an error when running the code.
obj = (ClassX)Activator.CreateInstance(Type.GetType("classPrefix_" + className));
ArgumentNullException was unhandled
Value cannot be null
Parameter name: type
Any help on this error would be apprecia...
I've been learning how to use Python for the better part of today after giving up on an ugly bash script.
I'm trying to use 2 classes to define a few arrays of objects in which to store some unique strings and integers (1-10). The objects will consist of the following:
object[i].user
.n # n = i
.name
.co...
Some of what I've been reading about this yesterday and today:
(SO) Should you avoid static classes?
(SO) When to Use Static Classes in C# - Mark S. Rasmussen makes a nice comment here
Singleton vs Static - Nice quote from here:
These differences are extremely subtle but they do impact how resilient the system will hold up after years ...
I am using a SafeFileHandle to talk to USB devices. If I close a Handle and then reopen a handle to the same device (assuming is has not been removed and reattached/enumerated) will the first and second handles necessarily be exactly the same? Or is a handle like an instance thing that can be different every time it's opened?
...
Hello,
I'm having a problem when using variables in object names.
I have a Public class which is called "Tank"
In that class, there is a public property called "direction" of an integer type.
I keep getting the error:
"Tank is a type and cannot be used as an expression"
What I'm doing wrong here ?
Public Class mainroutines()
' Creat...
This is probably a dumb question but I'm going to ask it anyways... I am programing in C#.NET. I have a class that contains a non-static, instance EventHandler. Is it possible to trigger that EventHandler for every instance of the class that exists from a static method?? I know this is a long shot!
...
Hi all,
I found out that the FormWizard only __init__'s once, when the url is request by multiple users at the same time (me in 2 browsers :).
This results in the fact that my temporarily stored data on the wizard's instance is wrongfully shared between users.
I'm doing some DB hits in the second step, and based on that outcome I do a...
I'm new to jedit, and I haven't yet found out how to open a new window. For example, I want to be editing one set of files in one space on my Mac, and edit a different set of files in another. Does anyone know how to open a new instance/window of jedit to make this possible?
Thanks
...
Suppose you have something like this:
class intlist:
def __init__(self,l = []):
self.l = l
def add(self,a):
self.l.append(a)
def appender(a):
obj = intlist()
obj.add(a)
print obj.l
if __name__ == "__main__":
for i in range(5):
appender(i)
...
I'm trying to make a simple scheduler service that will automatically send emails, etc.
For now I have simple WCF service in which I create an instance of a timer, set a callback and do some work in the callback. Now this part works fine, with the callback being called and the work in it being done as expected.
The issue is I need to m...
Hey,
I am trying to access an instance variable which is set in the controller in the model. The controller is the products controller and the model is the products model. The instance variable is a instance of another model called account.
The instance variable is @current_account
When I run the code nothing happens, I do not get an ...
Hey, I just wondering how I could replace the second instance of a string inside a string in php such as follows:
a - b - c
Where it would add an extra space after the second "-" but only if it finds 2.
Thanks
...
I have rewritten a VB6 application in Delphi. It should have only one instance running. How can I do this with minimum of code?
In VB6 we just have to use one single line of code
>
If App.PrevInstance Then
'Take some action
End If
On goggling I did find a solution but it is very length and we have to mess with .drp file....
Is it possible using Reflection or some other method to obtain a reference to a specific class instance from the name of that class instance?
For example the framework for the applications i develop heavily uses public class instances such as:
Public bMyreference as MyReference = new MyReference
Then throughout the application bMyRef...
I am developing an application which uses WindowsFormsApplicationBase to enforce Single Instance. I get the following error when calling a method on a Remote object. It works fine if I don't use Single Instance approach.
System.Runtime.Remoting.RemotingException: Authentication failure ---> System.IO.IOException: Unable to read data fro...