I'm trying to create a delegate of a static method which takes a ref argument. Please don't ask why I'm doing such a cockamamie thing. It's all part of learning how .Net, C#, and reflection work and how to optimize it.
My code is:
public struct DataRow
{
private double t;
static public void Cram_T(ref DataRow...
I have an implementation building a delegate handler collection.
public class DelegateHandler
{
internal delegate object delegateMethod(object args);
public IntPtr PublishAsyncMethod(MethodInfo method, MethodInfo callback)
{
RuntimeMethodHandle rt;
try
...
Hello!
The thing is I'm new on iPhone and Objective C development and I'd like to know what's the best way to call some function once you finished a task.
In my application what I do is load an internet hosted XML with some vars. To do this I have created this function called by the main view:
ApplicationVariablesLoader *loader = [ [ ...
Hello. I have an application wherein two threads write asynchronously to a single textbox. It works, except that the second thread to write to the textbox overwrites the line that the first thread just wrote. Any thoughts or insight into the problem would be greatly appreciated. I am using Microsoft Visual C# 2008 Express Edition. T...
How can I put AddressOf, from another class?
I get this error 'AddressOf' operand must be the name of a method (without parentheses). "
Is there an Eval () function in VB.NET? Or how does one do this?
Public Shared Property e As UserControl
Public Shared Sub SetButton(ByVal button As String, ByVal Objekt As [Delegate])
Dim errorbu...
I am confused that what is the actual role of a delegate? I have been asked this question many times in my interviews, but I don't think that interviewers were satisfied with my answer.
Can anyone tell me the best definition, in one sentence, with a practical example ?
Thanks
...
Instead of this can i write it in such a way that the definition is inside the function?
delegate object ObjFunc(long c);
static Object MyFunc(this SqlConnection conn, ObjFunc func)
{
return func(1);
}
...
I found this but tried to use it and failed.
How can i create an object using reflections and make it fast by putting it in a delegate?
DynamicMethod dm = new DynamicMethod("MyCtor", t, new Type[] { });
var ctor = t.GetConstructor(new Type[] { });
ILGenerator ilgen = dm.GetILGenerator();
ilg...
I have a scenario where I want to use method group syntax rather than anonymous methods (or lambda syntax) for calling a function.
The function has two overloads, one that takes an Action, the other takes a Func<string>.
I can happily call the two overloads using anonymous methods (or lambda syntax), but get a compiler error of Ambiguo...
I would like to have your opinion as to the pros and cons of using delegates instead of virtual functions aud subclassing?
...
I'm looking for Apple documentation regarding the "delegate" and "datasource" methods for NSTableView. They don't appear in the NSTableView Class Reference for some reason. Any idea where I can look? Here's an example of one of them:
- (void)tableView:(NSTableView *)tableView
setObjectValue:(id)object
forTableColumn:(NSTableC...
I have an app that has four tabbar controllers views in it. When the app starts up, all four are loaded via SQL select statements. How do I tell it not to load these controllers at startup, but to do it when I select a value from the first screen?
thx
wes
...
Thanks to Jon Skeet's answer in this question I have the following working:
public delegate BaseItem GetItemDelegate(Guid itemID);
public static class Lists
{
public static GetItemDelegate GetItemDelegateForType(Type derivedType)
{
MethodInfo method = typeof(Lists).GetMethod("GetItem");
method = method.MakeGenericMethod(new...
I would like to have a delegate that is constrained to returning one of two types; an ActionResult or a string. Is this possible?
...
I have a need to restrict certain numbers to valid ranges in my application. I created delegates to handle this. I don't know if this is the right way to do it; I'm running into something that feels wrong.
public delegate int RestrictInteger(int minimum, int maximum, int value);
public delegate decimal RestrictDecimal(decimal minumum, d...
Why does cocoa use delegates rather than inheritance?
...
I'm having issues understanding the concept of outlets how the iPhone deals with events. Help! Delegates confuse me too. Would someone care to explain, please?
...
i can use
MyFirstAppDelegate * Delegate = (MyFirstAppDelegate *)[[UIApplication sharedApplication] delegate];
[Delegate.navigationController popViewControllerAnimated:YES];
or
[self.navigationController popViewControllerAnimated:YES];
So what is the difference between both ?
Please answer me ......
Thanks in advance..
...
Here's my situation:
I have an app with 3 tabs. Tab 1 is a MKMapView. 2 is a navigation controller, with a table view, and 3 is going to be a table view with UI search bar or something different to the first two.
So, for my mapview, on viewDidLoad i want it to get the users current location, go off to a webservice and then drop some pi...
Hi,
I'm writing a small chat program in Java. I got some classes whose objects have to keep track of one another (e.g. the connection listener needs to update the GUI when a new message comes in, just like the GUI needs to write to the connection's writer, when the user wants to send a message).
In Cocoa on Mac OS X I'd write & impleme...