func Questions
2
I'm trying to get the method name of a function passed into an object using a .Net closure like this:
Method Signature
public IEnumerable<T> GetData<T>(Func<IEnumerable<T>>...
1
Solved
I wanna extract the Func<> from the following Expression :
Expression<Func<IQueryable<Entity>, IOrderedQueryable<Entity>>> order = q => q.OrderByDescending(c=>c.Fu...
Synthesize asked 4/12, 2013 at 6:33
2
Solved
How to check whether a Func has been called using the FakeItEasy framework?
Example:
Func<bool> myFunc = () => true;
// Unfortunately this fails:
A.CallTo(myFunc.Invoke()).MustHaveHappe...
Squashy asked 5/12, 2013 at 12:2
1
Solved
I tried:
from sqlalchemy import VARCHAR
result = session.query(Table).filter(func.convert(VARCHAR(8), Table.datetimefiedld, 8) >= some_date).all()
I got AttributeError: 'VARCHAR' object has n...
Nephrotomy asked 29/11, 2013 at 19:2
4
Solved
I am trying to move some code that I wrote to a more generic method. While the method is longer, the part I am having trouble with is the following :
public static void Test()
{
MyObjectType[] ...
3
Solved
I'm a very new to C#. Just playing around with it. Not for a real purpose.
void makeOutput( int _param)
{
Console.WriteLine( _param.ToString());
}
//...
// Somewhere in a code
{
makeOutput( /*...
1
Solved
I am trying to write a linq to entity extension method that takes a Func to select a property Id and compare it against a list of ids.
Classes
public class A
{
public int AId { get; set; }
}
pu...
Mode asked 27/9, 2013 at 13:50
1
Solved
I have many different functions, and they all have simple printf statements using __func__ similar to this one:
printf("%s - hello world!", __func__);
Now the problem I am running into is that in...
1
Solved
how can I get a body from function
Func<bool> methodCall = () => output.SendToFile();
if (methodCall())
Console.WriteLine("Success!");
I need to get this output.SendToFile() as a str...
Solvent asked 16/7, 2013 at 10:14
1
Solved
1
Solved
I have this Class:
public class Order
{
int OrderId {get; set;}
string CustomerName {get; set;}
}
I declare below variables, too
Func<Order, bool> predicate1 = t=>t.OrderId == 5 ;
Func&...
Gametophore asked 13/6, 2013 at 13:26
3
Solved
I have many methods that require some logging with the same pattern. Some methods need to return some value, some don't. I have created a method with Action parameter to avoid copypasting all of th...
2
I want to create a method that runs another method in a background thread. Something like this:
void Method1(string param)
{
// Some Code
}
void Method2(string param)
{
// Some Code
}
void Run...
Samala asked 1/4, 2013 at 17:22
1
Solved
I've searched a bit about type inference, but I can't seem to apply any of the solutions to my particular problem.
I'm doing a lot of work with building and passing around functions. This seems to...
Broadwater asked 29/3, 2013 at 2:39
4
Solved
Haven't fired up reflector to look at the difference but would one expect to see the exact same compiled code when comparing Func<T, bool> vs. Predicate<T>
I would imagine there is no...
2
Solved
1:
Func<int, int> myFunc = new Func<int,int>(delegate(int x) {
return x + 1;
});
2:
Func<int, int> myFunc = delegate(int x) {
return x + 1;
};
3:
Func<int, int> myF...
Valverde asked 23/2, 2013 at 15:7
2
Solved
When S and T are different, this works:
public static void Fun<S, T>(Func<S, T> func)
{
}
Fun((string s) => true); //compiles, T is inferred from return type.
But,
public stati...
Jedidiah asked 12/2, 2013 at 16:35
2
Solved
Lets imagine simple delegate calls:
void Main()
{
Func<int, int, string> tfunc = null;
tfunc += Add; // bind first method
tfunc += Sub; // bind second method
Console.WriteLine(tfunc(2,...
2
Solved
I am implementing a log handler in C++, and it works good and all, however there is one thing which I would find usable and that is where the logger got the output from.
I guess this isn't really ...
1
Solved
I have a method signature
bool TryGetItem(string itemKey,out Item item)
How can i encapsulate this signature in
delegate V Func<T,U,V>(T input, out U output)
as in the post: Func<T...
1
Solved
I would like to be able to do the following:
Func<int,bool> tryMethodFunc = TryMethod;
Where TryMethod has a signature like:
bool TryMethod(int value, int value2 = 0, double value3 = 100....
Pollack asked 10/12, 2012 at 16:51
3
Solved
With real examples and their use, can someone please help me understand:
When do we need a Func<T, ..> delegate?
When do we need an Action<T> delegate?
When do we need a Predicat...
4
Solved
I like to send a generic type converter function to a method but I can't figure out how to do it.
Here's invalid syntax that explains what I like to achieve, the problem is I don't know how to spe...
2
Solved
while deepening myself to more advanced features of C#, I came across some code, which I didn't exactly know the difference of. It's about these two lines:
Func<string, int> giveLength...
3
Solved
I want to create an object with a constructor containing predicate and func objects in the xml config using spring. The Predicate and the Func arguments should point to a method of another configur...
Fearful asked 12/8, 2011 at 10:59
© 2022 - 2024 — McMap. All rights reserved.