由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Question about delegate in C#
相关主题
Missing "nmsql.dll"【JOBS】04.01 -- 04.30
Android make file想辞职回加拿大,老板又给了个counter offer,犹豫中
an openning for System Integration Engineermy demo: Javascript? applet? servelet?
Nvidia Senior software engineer openingJob Opportunity
Nvidia Senior software engineer opening (转载)请教Windows下C++编程转到Linux下要学些什么?
相关话题的讨论汇总
话题: c#话题: function话题: question话题: delegate话题: parameter
进入Programming版参与讨论
1 (共1页)
J*****n
发帖数: 4859
1
Not quite familar with C#, so I would like to express it in C++ term.
I have a list of function ptrs, which all take one parameter.
I have a function f, which have 2 parameters, assume f(x, y).
Is there any way I can insert f(x, 1) as a single variable function in above
list?
Thank you.
m*******l
发帖数: 12782
2
i think closure/lambda should work

above

【在 J*****n 的大作中提到】
: Not quite familar with C#, so I would like to express it in C++ term.
: I have a list of function ptrs, which all take one parameter.
: I have a function f, which have 2 parameters, assume f(x, y).
: Is there any way I can insert f(x, 1) as a single variable function in above
: list?
: Thank you.

g****r
发帖数: 1589
3
I think curring is not supported out of box, but you can write a lamada to
convert it to a single parameter function as (x)=>f(x,1);

above

【在 J*****n 的大作中提到】
: Not quite familar with C#, so I would like to express it in C++ term.
: I have a list of function ptrs, which all take one parameter.
: I have a function f, which have 2 parameters, assume f(x, y).
: Is there any way I can insert f(x, 1) as a single variable function in above
: list?
: Thank you.

s***o
发帖数: 2191
4
yes currying or partial function. Jon Skeet has a wonderful post on this
topic:
http://msmvps.com/blogs/jon_skeet/archive/2012/01/30/currying-v

【在 g****r 的大作中提到】
: I think curring is not supported out of box, but you can write a lamada to
: convert it to a single parameter function as (x)=>f(x,1);
:
: above

1 (共1页)
进入Programming版参与讨论
相关主题
Nvidia Senior software engineer opening (转载)请教Windows下C++编程转到Linux下要学些什么?
【JOBS】04.01 -- 04.30Missing "nmsql.dll"
想辞职回加拿大,老板又给了个counter offer,犹豫中Android make file
my demo: Javascript? applet? servelet?an openning for System Integration Engineer
Job OpportunityNvidia Senior software engineer opening
相关话题的讨论汇总
话题: c#话题: function话题: question话题: delegate话题: parameter