iolanda
iolanda

Reputation: 1

Function in visual basic

I am very new in programming and I have been given the task to translate a script from vb into c#. I have the following line of code which, for as much as I can google it, I can't make sense of it:

aim_tonnes = dailyRecords.Where(Function(record) record.dt_start.Hour = 0).Sum(Function(record) record.ms_aim_production)

I do understand the meaning of it but what I struggle with is Function(record) as I can't find it declared anywhere in the original script and I don't understand what it does. Is anyone able to give me some directions? Thanks a lot, really appreciated!

Upvotes: 0

Views: 111

Answers (1)

user18387401
user18387401

Reputation: 2562

That's a lambda expression.

Function(record) record.dt_start.Hour = 0

would translate to:

record => record.dt_start.Hour == 0

Upvotes: 1

Related Questions