delegates

How make Dictionary with lambda functions, with different numbers of parameters [closed]

不打扰是莪最后的温柔 提交于 2019-12-13 22:13:49
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . How make Dictionary with lambda functions, that Func<> contains different numbers of parameters? Dictionary<string, Func<T, double>> operationsList = new Dictionary<string, Func<T, double>>(); It mast be so? 回答1: You can make your dictionary type Delegate , but I'm pretty sure that calling Func<>

Create Expression<Func<TEntity,object>> dynamically and call Aggregate to IQueryable<TEntity>

ⅰ亾dé卋堺 提交于 2019-12-13 22:05:43
问题 I'd like to create an Expression<Func<TEntity, object>> so as to later pass it to function as parameter. If I use the following function for creating it... public Expression<Func<TEntity, object>> GetInclude(string property) { ParameterExpression parameter = System.Linq.Expressions.Expression.Parameter(typeof(TEntity)); System.Linq.Expressions.Expression ppty = System.Linq.Expressions.Expression.Property(parameter, property); LambdaExpression lambda = System.Linq.Expressions.Expression.Lambda

Present login screen on app startup

妖精的绣舞 提交于 2019-12-13 20:26:50
问题 In my previous question on UIView animations I mentioned that I have to simulate the modal behavior for some view. Here I'll explain why and ask about some better solution. The first view a user should see in my app is the login screen. Upon successful authentication the program checks if the user is a parent or a child (in a family). For each of these roles the app must provide different functionality. So I designed the app like this: Declare outlets for the login view controller and a tab

Func for 5 arguments

為{幸葍}努か 提交于 2019-12-13 19:17:40
问题 I am working with System.Func but have reached a stumbling block with it. System.Func<TReturn> // (no arg, with return value) System.Func<T, TReturn> // (1 arg, with return value) System.Func<T1, T2, TReturn> // (2 arg, with return value) System.Func<T1, T2, T3, TReturn> // (3 arg, with return value) System.Func<T1, T2, T3, T4, TReturn> // (4 arg, with return value) The max it accepts is 4 arguments. Is there any way of extending this to 5 arguments? 回答1: You have a few options one is to

Does it make any sense to release ivars in appdelegate's dealloc?

陌路散爱 提交于 2019-12-13 18:02:15
问题 I know that probably it's a good practice to release appdelegate's ivars in its dealloc method, but practically, does it makes any sence? As I understand the appdelegate of an iPhone app will live in memory while the application is running and all memory will be freed anyway when it's closed. Thank you 回答1: Good memory management should be a habit. The more you have to think about when and where it applies the more likely you are to make mistakes. That may be reason enough alone to do it.

access values within custom eventargs class

☆樱花仙子☆ 提交于 2019-12-13 17:34:59
问题 Do I always need to use a delegate / Eventhandler to get to the data stored within a custom EventArgs class or can I access it directly? 回答1: A custom EventArgs class is just like any other class. If you have an instance of it, you can access it's (visible) members. Typically, however, EventArgs is only used in conjunction with events, and you need a delegate to subscribe to an event. As such, it would normally be used (from the consumption side) with some form of delegate, though this could

Rigtht way to implement Aysnchronous Delegate Methods

耗尽温柔 提交于 2019-12-13 17:27:26
问题 Consider the following situation. -(void) foo { Object * obj = [[Object alloc] init]; obj.delegate = self; [obj excuteAsync]; } -(void) delegateMethodReturned { // do something } Here executeAync returns aynchronously after sometime. Thus we cannot release obj safely. What is the best design pattern to implement such a situation without declaring obj as an iVar. Thanks 回答1: If you can target iOS4 you could circumvent the asynchronous callback using blocks and GCD. dispatch_queue_t queue =

Using Delegates with Exchange Web Services

旧巷老猫 提交于 2019-12-13 17:25:31
问题 Has anyone used delegates with exchnage web services? I would like one user to be able to control other users' calendars in Exchange. I'm finding this problem to be a little tricky, and I'd like to see how others have been able to get it to work properly. 回答1: I'm just getting started here, but i managed to get access to Resource calendars via a delegate account. I used the recommendations from this article about delegate account and resource accounts. (Resource accounts are tricky because

UIAlertView delegate method crashing

穿精又带淫゛_ 提交于 2019-12-13 16:55:41
问题 In my iPhone app, I have a NSObject A class and a UIViewController B class. I want to call a instance method in B class from A. I used the following code. Bclass *vc = [[Bclass alloc]init]; [vc hideAlert:NSString]; [vc release]; and in B class: - (void)hideAlert:(NSString*)message{ UIAlertView *shareAlrt = [[UIAlertView alloc] initWithTitle:@"" message:message delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [shareAlrt show]; [shareAlrt release]; } and the method called and show

Word Wrap with HTML? QTabelView and Delegates

限于喜欢 提交于 2019-12-13 16:35:45
问题 I followed this post which explains on how to use HTML with TableViews using Delegates. Now here is a twist and I cant figure this out How can I make my html word wrap. For instance if the text is : "I am the very model of a modern major general, I've information vegetable animal and mineral, I know the kinges of England and I quote the fights historical from Marathon to Waterloo in order categorical..." Currently everything appears on one line on the cell of the tableView. Is there a way for