發布:2019-05-04 17:15:00編輯:視頻君來源:視頻教程網
知識點:《foreach》 收集:黨唇屢 編輯:月季姐姐
本知識點包括:1、C#中要使用foreach需要實現什么接口或類 2、js中的 map,foreach,reduce 之間有什么區別么 3、jsp中要使用迭代標簽c:forEach需要導入哪兩個包? 4、C#中的foreach 怎么用啊 5、foreach和for循環的區別 。
per 介詞 prep.
1.〈拉〉(表示關涉)通過,由
Do you send the goods per rail,or per plane?
你送這個商品是通過鐵路還是飛機?
Your car,per Mary,has reached me.
你的車由瑪麗給我.
2.(表示根據)依照,根據
You bought goods per list price.
你按照所列價格買商品.
3.(表示比率)(尤指數量,價格,時間)每
These apples cost 40 pence per pound.
這些蘋果每磅40便士.
4.每,每一
副詞 adv.
1.每次;每個
2.照常;按慣例
形容詞 adj.
1.高的;過的;全的
each 形容詞 adj.
1.每一,各個的
Each school has its library.
每一所學校都有圖書館.
Each one of us has his own duty.
我們每個人都有自己的職責.
Each boy and each girl works hard.
每個學生都努力學習.
代詞 pron.
1.每個; (兩個或兩個以上的人或物中)各自,各個,每個
There were three students who called and I gave a book to each.
來了三個學生,我發給每個人一本書.
Each of us has a company car.
我們每人都有一輛公司的汽車.
Each of you have to work together with one heart.
你們大家要齊心合力.
The witnesses were each perfectly certain of what they said.
證人們個個對自己所說的話十分肯定.
Peter and Bill each say they came first in the race.
彼得和比爾都說自己跑了第一.
The French and Germans each claimed the territory.
法國人和德國人都聲稱這塊土地是他們的.
We each have our own particular tastes,haven't we?
我們各有所好,不是嗎?
副詞 adv.
1.每,各自
They both hold each an opinion.
他們倆各執己見.
per 是介詞,而 each 是形容詞,中文意思都是“每個”,所以兩者不能同時使用。
你的句子是正確的,不必改。
由于 per 的意思是“每個”,所以后面的名詞只能用單數。
each與every雖然都有“每個”的意思,但二者含義及語法功能不同.例如,each既可用作形容詞,又可用作代詞,every只能作形容詞;用作形容詞作定語時,each更強調個人或個別,every表示“每個”之意,含有“全部”之意味,等等.兩個詞的差異總結如下:
一、each既可用作形容詞,又可用作代詞,在句中可以作定語,主語、賓語、同位語、狀語等;every只能作形容詞.
如:
Each student has his own desk.
每個學生都有自己的桌子.(形容詞,定語)
The students each have a desk.
學生們每人有一張書桌.(代詞,同位語)
Each has his good point.
各人有各自的優點.(代詞,主語)
Our head teacher had a talk with each of us.
我們的班主任與我們每個人都談了話.(代詞,賓語)
The children can have a bag each.
孩子們每人可帶一只提包.(副詞,狀語)
Every member has a share in the profits made by the company.
每個會員可分享公司的盈利.(形容詞)
二、each與every都可用作形容詞,在句中作定語,但each更強調個人或個別,every表示“每個”之意,含有“全體”、“全部”之意味.
如:
I know each number of your family.
我認識你們家的每個成員.(強調每一個都認識)
I know every number of your family.
我認識你們家的每個成員.(強調認識全家人)
三、each指兩個或兩個以上的人或事物中的“每個”;every是指許多人或事物的“全”.
如:
我給她父母每人一件禮物.
〔誤〕I gave a present to every one of her parents .
〔正〕I gave a present to each of her parents .
四、指上下文提到過的確定數目中的“每一個”時,要用each;如果上下文沒有提及時,不能用each,要用everyone等.
如:
我認為這三個答案個個都正確.
〔誤〕I think every answer of the three is right .
〔正〕I think each of the three answers is right .
我看見人人都忙著工作.
〔誤〕I saw each was busy with his work .
〔正〕I saw everyone was busy with his work .
五、each 單獨做主語或each、every修飾的單數名詞做主語時,謂語動詞為單數形式,但each of them做主語時,謂語動詞用單數或復數形式都可以.
如:
Each / Each person / Every person is living a happy life now.
人人都過著幸福生活.
Each of them are / is wearing full dress.
他們個個都身著盛裝.
六、every可以與not連用構成部分否定,意思是“并不/非所有人”,而each則不可以與not連用.全部否定是no one ,意思是“個個都不”、“沒有人”等.
如:
人人都不喜歡這個電視劇.
〔誤〕Each / Everyone / Every one of them doesn’t like the TV play .
(表示并不是所有人都喜歡這個電視劇,并不排除可能還有人喜歡)
〔正〕No one likes the TV play .
七、each與other可構成相互代詞,every則不可以.
如:
We should take care of each other and help each other.
我們應該互相關心,互相幫助.
八、表示“每隔……”、“每……”,要用“every+基數詞+復數名詞”.這種結構中的every不能用each替代.
如:
They’ll choose one out of every ten girls .
他們將在每十個姑娘里挑選一個.
We hand in our homework every three days.
我們每隔兩天(每三天)交一次作業.
注意:“每三天或每隔兩天”,也可以寫作“every third day”,即,若用序數詞時,后接單數名詞.再如every four weeks / fourth week(每四周/每隔三周),every other day / second day / two days(每隔一天),every other line(每隔一行)等.
each:[ i:tʃ ]
a.每個,每,每一
ad.每個
int.每個,個人,個自
例句與用法:
1.Each man has his own name.
每個人都有自己的名字.
2.We each have our private views about it.
我們每個人對這件事都有自己的看法.
3.I asked all the children and each told a different story.
我問過所有的孩子,每個人的說法都不一樣.
4.He examined each piece of evidence in isolation.
他分別審查每一證據.
形容詞each:
1.(used of count nouns) every one considered individually
副詞each:
1.to or from every one of two or more (considered individually)
Each,譯為:每一..
Each of譯為:...中的每一
當each后跟的是名詞時,用each,如:each person(每個人),each student(每位學生)
當each后跟的是代詞時,用短語each of,如each of us(我們中的每一個)each of them(他們中的每個)
用Each組成的短語謂語表第三人稱單數的哦!就是它得進行一定的變化.如:
Each person here is my classmates.在這里的每位學生是我的同學.
Each of them likes studying very much.他們中的每個人都非常喜歡學習.
Each的用法
一、each作“各自的”,“每個的”解,作形容詞用:
1.There are many trees on each side of the river.河流兩岸許多樹.
2.Each element has some special properties.每種元素都有些特殊性質.
二、作“各子”、“每個”講,作代詞用:
1.Each has his advantages.各人都有其優點.
2.He gave each of us a tool.他給我們每人一件工具.
三、作“各子地”講,作副詞用:
1.Give them two books each.(=Give each of them two books.)給他們每個人兩本書.
2.The students have ten books each.(=Each of the students has ten books.)這些學生每人有十本書.
3.Different kinds of waves have each the same three characteristics:amplitude,frequency and length.不同的波(各)都有三個相同的特性:幅度、頻率和波長.
四、注意each作同位語的用法:
1.They each put forward a proposal.他們每人提出一條建議.
2.The workers are each of them hard-working.這些工人個個勤奮勞動.
五、each other作“互相”、“彼此”
1.We help each other.我們互相幫助.
2.They speak English to each other.他們彼此講英語.
3.We often compare notes with each other on our work and study.我們經常就工作和學習方面互相交換意見.
六、each和every詞義辨異:
Ⅰ.every只能作形容詞,只有在與名詞連用或構成復合詞(如everybody每個人)時,才能作主語或賓語等,而each還可以作代詞,直接作主語或賓語(見本文二各例句).
Ⅱ.every雖指每個,而概括全體,而each只是指“每個”,卻以“各……”為主.例如:
1.I know every member of the class.全班的人我都認識.(著重全體,即雖指每個,而概括全體.)
2.I know each member of the class.這個班每個人我都認識.(“個別”意義較重.)
3.We must correct every single error.我們必須改正所有錯誤.(著重全體.)
4.They each have a tool.他們每人有一件工具.(“個別”意義較重.)
5.Hydrogen and sodium each have one electron in the outer layer.Each has a combining power of one.They each have one electron to lend to anther atom.氫和鈉在外層各有一個電子.它們的化合價都是1.它們各有一個電子可借給其他原子.(句中第一、三個each作同位語,第二個each為代詞作主語.這三個each都是“個別”意義較重.句中第二個one是通過of引出的同位語.)
each強調個體,既可以做形容詞修飾名詞,有可以直接作代詞作主語.
each man and woman時,他作形容詞修飾名詞.
we each應該是表示我們每個人如何如何.
each of表示其中的每一個人,如each of us,each of them,表示我們中的每一個或他們中的每一個都如何如何.另外,every后不加of
提示:能用foreach遍歷訪問的對象必須是集合或數組對象,而這些都是靠實現超級接口IEnumerator或被聲明 GetEnumerator 方法的類型。
提示:forEach: 對數組中每一個元素都運行函數,該方法沒有返回值。如果你想對數據里的每一個元素進行處理,可以采用forEach來替換 for循環 map:對數組中每一個元素都運行函數, 返回由每次函數執行的結果組成的數組。果你想對數據里的每一個元素進行處...
提示:上面一群人答非所問,還要相互粘貼,搞笑來的吧,實際上需要引jstl.jar和standard.jar包,不過樓主這么久過去估計早就解決問題了吧,我貼個答案湊個數
提示:foreach循環用于列舉出集合中所有的元素,foreach語句中的表達式由關鍵字in隔開的兩個項組成。in右邊的項是集合名,in左邊的項是變量名,用來存放該集合中的每個元素。 該循環的運行過程如下:每一次循環時,從集合中取出一個新的元素值。放到只...
提示:for循環 for循環,通過下標,對循環中的代碼反復執行,功能強大,可以通過index取得元素。在處理比較復雜的處理的時候較為方便。 foreach循環 foreach,從頭到尾,對于集合中的對象遍歷。適用于簡單的遍歷。foreach使用的時候,會鎖定集合的對象...