or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
Repeat & Range & Empty & DefaultIfEmpty
Generation Operators 可以幫助我們快速產生常見樣式的資料集合. 也就是說這些方法不需要提供類似型式的資料集合作為方法的輸入參數 , 並且回傳會 IEnumerable<T> 型態的資料集合. 例如 : 產生一個陣列後不需要手動地透過迴圈去塞值 , 而是可以透過一個方法產生這樣的陣列.
隸屬於 Generation Operators 的方法有
Repeat
Repeat 方法可以產生指定數量重複值的序列.
使用時機
Repeat 的用法
輸出結果
I am City ~~
I am City ~~
I am City ~~
I am City ~~
輸出結果
*
**
***
****
*****
簡單實作自己的 Repeat
Range
相對於 Repeat 能夠產生以某個值作為重複值的序列 , Range 能夠產生的序列是由遞增排序的數字組成.
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →使用時機
與 select 搭配 , 甚至可以取代 for 迴圈. 有點像是 Python 的感覺. 至於哪個好 , 就見仁見智了XD
Range 的用法
輸出結果
*
**
***
****
*****
簡單實作自己的 Range
Empty
回傳一個 IEnumerable<TResult> 型態的空序列.
使用時機
Empty 的用法
輸出結果
Adams, Terry
Andersen, Henriette Thaulow
Hedlund, Magnus
Ito, Shu
Solanki, Ajay
Hoeing, Helge
Potra, Cristina
Iallo, Lucio
簡單實作自己的 Empty
參考資源
DefaultIfEmpty
如果序列是空的 , 則傳回塞入一個預設值的序列.
使用時機
DefaultIfEmpty 的用法
輸出結果
簡單實作自己的 DefaultIfEmpty
Summary
Thank you!
You can find me on
若有謬誤 , 煩請告知 , 新手發帖請多包涵
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →