Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
C#のList<T>がIListを実装している件
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
RyotaMurohoshi
January 31, 2015
Technology
93
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
C#のList<T>がIListを実装している件
2015/01/31の富山合同勉強会 .NET & Java ~ぶりしゃぶで休もう~で発表した際の資料です
※元々はSlideShareで公開していた資料です
RyotaMurohoshi
January 31, 2015
More Decks by RyotaMurohoshi
See All by RyotaMurohoshi
Tilemapのアップデートについて
ryotamurohoshi
0
96
Unityの合同同人誌や合同商業誌を書いてる僕は感想やレビューや評価が欲しい
ryotamurohoshi
0
630
Unity 2021.1での Unityパッケージの名称変更について
ryotamurohoshi
0
900
Odin Validationはいいぞ!
ryotamurohoshi
2
1.1k
Tilemapはいいぞ!2020 〜すごいぞ、プロジェクト専用拡張Brush〜
ryotamurohoshi
0
2.6k
Unityでも、新しいC#
ryotamurohoshi
0
1.5k
Riderはいいぞ!
ryotamurohoshi
1
3.8k
Riderのススメ〜俺はRiderここが好き〜
ryotamurohoshi
1
2.8k
Unity開発者に伝えたい.NETのこと
ryotamurohoshi
4
38k
Other Decks in Technology
See All in Technology
omasushiというライブラリを作った
polidog
PRO
0
200
AI時代だからこそ、スケールしないことをやろう
yutashigemura
1
150
2026-09-11 【Snowflake World Tour Tokyo 2026】Snowflakeを起点に、AI Agentが自律稼働し続ける未来へ / Driving AI Agents with Snowflake
civitaspo
0
340
Tab5をRubyで動くパソコンにする
kishima
2
350
なぜSRE・セキュリティは評価されないのか?守りの組織を事業成長エンジンに変えた実践
cscengineer
PRO
3
2.5k
リージョンの壁を越える、 ちょっと変わったAWSサービスの話
falken
PRO
1
310
Claude Code本って、 読む必要あるの?
oikon48
2
410
Amazon Quick on DesktopがIAM Identity Centerで動かない理由
yukiogawa
0
170
山手線を徒歩で一周してわかった、 位置情報アプリは「足」が最強のデバッガー
hinakko
0
110
あるけみー式LTスライド作成術
alchemy1115
1
190
module Synths; end
asonas
1
130
薬剤師(ドメインエキスパート)と一緒に育てる薬局向けAIアシスタント
kakehashi
PRO
2
150
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
400
AI: The stuff that nobody shows you
jnunemaker
PRO
9
990
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
GitHub's CSS Performance
jonrohan
1033
470k
Odyssey Design
rkendrick25
PRO
2
800
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
520
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
490
Building Adaptive Systems
keathley
44
3.2k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
680
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
690
Transcript
C#ͷList<T>͕IListΛ࣮͍ͯ͠Δ݅
ࣗݾհ
໊લɿࣨ!྄ଠ ॴଐɿFuller,'Inc.
2લ·ͰJavaͬͯ·ͨ͠ʂ AndroidΞϓϦ։ൃͬͯ·ͨ͠ɻ
ࠓC#ͬͯ·͢ʂ C#(Mono2.x)ͰUnityͰήʔϜ࡞ͬͯ·͢ʂ
ͦΜͳࢲ͕͋ΔٙΛ Ϳ͚͍ͭͨͱࢥ͍·͢ʂ
C#ͷList<T>͕IListΛ࣮͍ͯ͠Δ݅ ਖ਼IListΛ࣮͢Δඞཁ͕ͳ͍ͱࢥͬͯ·ͨ͠ ͦͯ͠ɺͪΐͬͱ͕͋Γ·͢
Կ͕͔ʁ List<string> stringList = new List<string> (); IList list =
stringList; list.Add (1); // ίϯύΠϧ௨Δ ࣮ߦ࣌ʹྫ֎ൃੜʂ List<T>ͷΠϯελϯεΛIListΠϯλʔϑΣʔεͷมʹೖ System.ArgumentExcep1on͕ൃੜ͢Δ͜ͱ͕͋Δʂ ※List<T>C#ͩͱΫϥεͰ͢
എܠΛઆ໌͠·͢
C##2.0͔ΒδΣωϦοΫ͕ಋೖ͞Ε δΣωϦοΫͳίϨΫγϣϯͷ ΫϥεɺΠϯλʔϑΣʔε͕Ճ͞Ε·ͨ͠ (System.Collec-ons.GenericԼ)
δΣωϦοΫΠϯλʔϑΣʔεͷྫɹ(໊લͷઌ಄ʹI͕ͭ͘) • IList<T> • IDic,onary<TKey,5TValue> δΣωϦοΫΫϥεͷྫɹ(ΠϯλʔϑΣʔε͡Όͳͯ͘Ϋϥε) • List<T> • Dic+onary<TKey,4TValue>
͡Ό͋ͦͷલɺC##1.01.1Ͱʁ
System.Collec,ons໊લۭؒԼͷ ඇδΣωϦοΫͳผͷίϨΫγϣϯ ྫ͑IListͱ͔IDic(onaryͱ͔ArrayListͱ͔ ͋ͱɺSystem.Collec,ons.Specialized໊લۭؒԼʹ
ϙΠϯτ C#ͷδΣωϦοΫίϨΫγϣϯͱ ඇδΣωϦοΫίϨΫγϣϯ ผͷΫϥεɾผͷΠϯλʔϑΣʔε (͜͜Javaͱҧ͏ʂ)
IListΠϯλʔϑΣʔε ͱ IList<T>ΠϯλʔϑΣʔε
IListΠϯλʔϑΣʔε ඇδΣωϦοΫͳϦετΛ࢘ΔΠϯλʔϑΣʔε • ϝιουͱϓϩύςΟͷҰྫ "*"void"Add(Object"value)"ཁૉͷՃ "*"Object"this[int"index]"{"get;"set;"}"ΠϯσΫα • ܧঝ͍ͯ͠ΔΠϯλʔϑΣʔεICollec@onͱIEnumerable
IList<T>ΠϯλʔϑΣʔε(1) δΣωϦοΫͳϦετΛ࢘ΔΠϯλʔϑΣʔε ϝιουͱϓϩύςΟͷҰྫ • void&Add(T&ietm)&ཁૉͷՃ • T&this[int&index]&{&get;&set;&}&ΠϯσΫα δΣωϦοΫͳϝιουͱϓϩύςΟʹʂ
IList<T>ΠϯλʔϑΣʔε(2) ܧঝ͍ͯ͠ΔΠϯλʔϑΣʔε • ICollec(on<T> • IEnumerable<T> • IEnumerable IListΠϯλʔϑΣʔεΛܧঝ͍ͯ͠ͳ͍ʂ
IListΠϯλʔϑΣʔεͱIList<T>ΠϯλʔϑΣʔε • ϝιουͱϓϩύςΟࣅ͍ͯΔͷ͋Δ • ඇδΣωϦοΫ͔δΣωϦοΫ͔ͱ͍͏େ͖ͳҧ͍ • ܧঝؔͳ͍ʢ͜͜ॏཁʂʣ
ϙΠϯτ IList<T>ΠϯλʔϑΣʔε࣮͢Δ͔Βͬͯɺ ඞͣIListΠϯλʔϑΣʔε࣮͢Δඞཁͳ͍
List<T>ΫϥεͲ͏ͳ͍ͬͯΔʁ
List<T>Ϋϥε͕࣮͍ͯ͠ΔΠϯλʔϑΣʔε • IList'<)͜͜ʂʂʂʂ • IList<T>'<)͋ͱ͜͜ʂ • ICollec1on • ICollec1on<T> •
IReadOnlyList<T>ɺIReadOnlyCollec1on<T> • IEnumerable<T>ɺIEnumerable
List<T>ΫϥεIList<T>Λ࣮ Ճ͑ͯඇδΣωϦοΫͳIList ࣮͍ͯͯ͠ɽɽɽ
݁Ռ͜͏ͳΔ List<string> stringList = new List<string> (); IList list =
stringList; list.Add (1); // System.ArgumentException͕ൃੜʂ ໌ࣔతͳΠϯλʔϑΣʔεͷ࣮ͳΜͪΌΒׂѪ
List<T>͕IList࣮͍ͯ͠Δͷඞཁͳ͘ͳ͍ʁ IList<T>࣮ͯ͠Δ͔ΒɺͦΕͰΑ͘ͳ͍ʁ Ή͠ΖIListअຐ͡Όͳ͍ʁ
ͳͥList<T>IListΛ ࣮͍ͯ͠Δ͔ௐͯΈͨ
stackoverflow h"p:/ /stackoverflow.com/ques5ons/6156010/why<list<implements<ilist
δΣωϦοΫ͕ಋೖ͞ΕͨC##2.0/.NET#2.0 ͕ొͨ࣌͠Λ૾͠·͠ΐ͏
200512݄8
AKB48&ܶͰॳެԋ
ͷ1ϲ݄લɺ200511݄7 .NET%2.0ϦϦʔε(wikipediaΑΓ)
C#1.0ͱ1.1Ͱ વશͯͷίʔυ͕ඇδΣωϦοΫʂʂʂ ͦͷͨΊطଘͷίʔυɺ Ҿͱͯ͠List<T>IList<T>ͱΒͳ͍ʂ
͜͜ͰIList͕׆༂ʂ
List<T>Ϋϥε IListΠϯλʔϑΣʔεΛ࣮ͯ͠Δ͓͔͛Ͱ IListΛҾʹͱΔϝιουʹList<T>ΛͤΔ
طଘͷC##1.0/1.1ͷϥΠϒϥϦͰɺ IListҾʹͱΔϝιουʹ List<T>ΛͤΔʂ
ͭ·ΓList<T>͕IListΛ࣮ͨ͠ͷɺ ඇδΣωϦοΫίϨΫγϣϯ͔ΒδΣωϦοΫίϨΫγϣϯͷ ҠߦΛεϜʔζʹߦ͏ͨΊʁ طଘࣗ࡞ϥΠϒϥϦ͕List<T>ҾʹऔΕͳ͍͔ΒΘͳ͍Λࢭ͢ΔͨΊʁ ʮIListΛҾʹͱΔϝιουʹList<T>ͤΔͳΒɺList<T>ͬͯΈΔ͔ʂʯ͕ૂ͍ʁ
Ͳ͏Ͱ͠ΐ͏ʁ ͋ͬͯ·͔͢Ͷʁ
ͦΕͱ͔ͯ͠͠ࢲ͕Βͳ͍͚ͩͰɺ IListͷ׆༻໘ଟ͔ͬͨΓ͠·͢ʁ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠