Dab tsi yog kev siv lambda qhia hauv C #?
Dab tsi yog kev siv lambda qhia hauv C #?

Video: Dab tsi yog kev siv lambda qhia hauv C #?

Video: Dab tsi yog kev siv lambda qhia hauv C #?
Video: Data Science with Python! Sorting pandas DataFrames 2024, Kaum ib hlis
Anonim

A lambda qhia yog ib txoj hauv kev yooj yim ntawm kev txhais cov npe tsis qhia npe (tsis muaj npe) muaj nuj nqi uas tuaj yeem dhau los ua qhov sib txawv lossis raws li parameter rau txoj kev hu. Ntau LINQ txoj kev siv a muaj nuj nqi (hu ua delegate) raws li qhov parameter.

Nyob rau hauv txoj kev no, dab tsi yog lambda kab zauv siv rau?

Lambda qhia yog ib qho kev ua haujlwm tsis qhia npe uas muab cov ntsiab lus tseem ceeb thiab ua haujlwm zoo uas yog ntxiv siv rau sau cov txheej txheem tsis qhia npe. Lub programming ntawm lub luag haujlwm yog lub tswvyim lub cev, thiab nws yog siv rau tsim kev qhia ntoo hom lossis delegates.

Tom qab, lo lus nug yog, dab tsi yog lambda qhia thiab dab tsi yog qhov zoo ntawm kev siv nws? Qhov zoo ntawm Lambda Expression Tsawg Kab Code: Ib qho ntawm feem ntau cov txiaj ntsig ntawm a lambda qhia yog kom txo tus lej code. Peb paub tias lambda lus tuaj yeem yog siv tsuas yog nrog ib tug haumxeeb interface. Piv txwv li, Runnable yog qhov ua haujlwm tau zoo, yog li peb tuaj yeem thov tau yooj yim lambda lus.

Ib yam li ntawd, koj sau lambda muaj nuj nqi hauv C# li cas?

Siv cov lambda declaration operator => cais cov lambda cov parameter sau los ntawm nws lub cev. Tsim ib tug lambda qhia , koj qhia kom meej input parameters (yog tias muaj) nyob rau sab laug ntawm lub lambda operator thiab ib kev qhia los yog ib nqe lus thaiv ntawm lwm sab. Thaum koj siv txoj kev -based syntax hu rau Enumerable.

Lub cim lambda txhais li cas?

Greek tsab ntawv "L," uas yog siv los ua a cim rau "wavelength." A lambda yog ib qho tshwj xeeb zaus ntawm lub teeb, thiab lub sij hawm yog dav siv nyob rau hauv optical networking. Xa "ntau yam lambdas" los ntawm fiber ntau yog tib yam li xa "ntau zaus" lossis "ntau xim." Saib WDM thiab wavelength.

Pom zoo: