SlideShare une entreprise Scribd logo
1  sur  40
Programming C#, 3rd Edition Introduction (part 1) 寶來 資工部 簡伯松 PoSung Chien (Poisson)
Agenda ,[object Object],[object Object],[object Object]
CHAPTER 6 ,[object Object]
運算子的分類 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Arithmetic operators ( 算數運算 ) Operator name Syntax Overloadable Basic assignment a  =  b No Addition a  +  b Yes Subtraction a  -  b Yes Unary plus (integer promotion) + a Yes Unary minus (additive inverse) - a Yes Multiplication a  *  b Yes Division a  /  b Yes Modulo (remainder) a  %  b Yes Increment ++ a, a ++ Yes Decrement -- a, a -- Yes
Comparison operators /  Relational operators ( 比較運算 ) Operator name Syntax Overloadable Equal to a  ==  b Yes Not equal to a  !=  b Yes Greater than a  >  b Yes Less than a  <  b Yes Greater than or equal to a  >=  b Yes Less than or equal to a  <=  b Yes
Logical operators ( 邏輯運算 ) Operator name Syntax Overloadable Logical negation (NOT) ! a Yes Logical AND a  &&  b Yes Logical OR a  ||  b Yes
Bitwise operators ( 位元運算 ) Operator name Syntax Overloadable Bitwise NOT ~ a Yes Bitwise AND a  &  b Yes Bitwise OR a  |  b Yes Bitwise XOR a  ^  b Yes Bitwise left shift a  <<  b Yes Bitwise right shift a  >>  b Yes
Compound-assignment operators  ( 複合賦值 ) Operator name Syntax Overloadable Addition assignment a  +=  b Yes Subtraction assignment a  -=  b Yes Multiplication assignment a  *=  b Yes Division assignment a  /=  b Yes Modulo assignment a  %=  b Yes Bitwise AND assignment a  &=  b Yes Bitwise OR assignment a  |=  b Yes Bitwise XOR assignment a  ^=  b Yes Bitwise left shift assignment a  <<=  b Yes Bitwise right shift assignment a  >>=  b Yes
Member and pointer operators  ( 成員及指標 ) Operator name Syntax Overloadable Array subscript a [ b ] Yes Indirection (&quot;variable pointed to by  a &quot;) * a No Reference (&quot;address of  a &quot;) & a No Member  b  of object pointed to by  a  (unsafe) a -> b No Member  b  of object  a a . b No Member pointed to by  b  of object pointed to by  a   (unsafe) a ->* b No Member pointed to by  b  of object  a  (unsafe) a .* b No
Other operators ( 其它 ) Operator name Syntax Overloadable Function call  See Function object . a ( a1, a2 ) Yes is operator object is string No True / False true, false Yes Ternary conditional a  ?  b  :  c No Size-of sizeof (a) sizeof ( type ) No Type identification typeof (a) typeof ( type ) No Cast (implicit, explicit) ( type ) a Yes Allocate storage new   type No
Unsafe  ,[object Object],[object Object]
運算子多載 ,[object Object],Stocks A = new Stocks(); Stocks B = new Stocks(); A + B = ? int add = 100 + 200;
DEMO ,[object Object],[object Object],[object Object],[object Object]
Operator pair define ,[object Object],[object Object]
運算子多載的缺點 ,[object Object],[object Object],[object Object],[object Object]
CHAPTER 7 ,[object Object]
Structs  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Structs  定義 ,[object Object]
DEMO ,[object Object],[object Object],[object Object],[object Object],[object Object]
Creating structs without new ,[object Object],[object Object]
CHAPTER 21 ,[object Object]
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Working with Directories ,[object Object],[object Object],[object Object],[object Object],[object Object]
Directory class methods ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DirectoryInfo class methods ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Directory VS. DirectoryInfo ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DEMO ,[object Object]
Working with Files ,[object Object],[object Object]
Experiment environment  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Performance of reading File
Reading or Writing Class  Use  Stream   Abstract class that supports reading and writing bytes.  BinaryReader/ BinaryWriter   Read and write encoded strings and primitive datatypes to and from streams.  File ,  FileInfo ,  Directory ,  DirectoryInfo   Provide implementations for the abstract  FileSystemInfo  classes, including creating, moving, renaming, and deleting files and directories.  FileStream   For reading to and from  File  objects; supports random access to files. Opens files synchronously by default; supports asynchronous file access.  TextReader , T ex tWriter ,  StringReader , S t ringWriter   TextReader  and  TextWriter  are abstract classes designed for Unicode character I/O.  StringReader  and  StringWriter  write to and from strings, allowing your input and output to be either a stream or a string.
Reading or Writing (cont.) Class  Use  BufferedStream   A stream that adds buffering to another stream such as a  NetworkStream . Note that  FileStream  has buffering built in.  BufferedStreams  can improve performance of the stream to which they are attached.  MemoryStream   A nonbuffered stream whose encapsulated data is directly accessible in memory. A  MemoryStream  has no backing store, and is most useful as a temporary buffer.  NetworkStream   A stream over a network connection.
Binary Files ,[object Object]
Buffered Streams ,[object Object],[object Object],[object Object],[object Object]
實作 buffered I/O ,[object Object],[object Object],[object Object],[object Object]
實作 buffered I/O (cont.) ,[object Object],[object Object],[object Object],[object Object]
Working with Text Files ,[object Object]
DEMO ,[object Object]
Thanks for attention

Contenu connexe

Tendances

Tendances (19)

3.5
3.53.5
3.5
 
Data types in c++
Data types in c++ Data types in c++
Data types in c++
 
C LANGUAGE - BESTECH SOLUTIONS
C LANGUAGE - BESTECH SOLUTIONSC LANGUAGE - BESTECH SOLUTIONS
C LANGUAGE - BESTECH SOLUTIONS
 
Glimpses of C++0x
Glimpses of C++0xGlimpses of C++0x
Glimpses of C++0x
 
Tutorial on c language programming
Tutorial on c language programmingTutorial on c language programming
Tutorial on c language programming
 
Python recursion
Python recursionPython recursion
Python recursion
 
User defined functions
User defined functionsUser defined functions
User defined functions
 
User defined functions in C programmig
User defined functions in C programmigUser defined functions in C programmig
User defined functions in C programmig
 
Function & Recursion
Function & RecursionFunction & Recursion
Function & Recursion
 
Operator Overloading and Scope of Variable
Operator Overloading and Scope of VariableOperator Overloading and Scope of Variable
Operator Overloading and Scope of Variable
 
Lecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.pptLecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.ppt
 
Header files of c++ unit 3 -topic 3
Header files of c++ unit 3 -topic 3Header files of c++ unit 3 -topic 3
Header files of c++ unit 3 -topic 3
 
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
 
Python libraries
Python librariesPython libraries
Python libraries
 
358 33 powerpoint-slides_1-introduction-c_chapter-1
358 33 powerpoint-slides_1-introduction-c_chapter-1358 33 powerpoint-slides_1-introduction-c_chapter-1
358 33 powerpoint-slides_1-introduction-c_chapter-1
 
C++ Programming Course
C++ Programming CourseC++ Programming Course
C++ Programming Course
 
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
 FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM) FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
 
Python algorithm
Python algorithmPython algorithm
Python algorithm
 
Polymorphism and its types
Polymorphism and its typesPolymorphism and its types
Polymorphism and its types
 

En vedette

Goede praktijken in overheidscommunicatie 2.0
Goede praktijken in overheidscommunicatie 2.0Goede praktijken in overheidscommunicatie 2.0
Goede praktijken in overheidscommunicatie 2.0
Vanden Broele
 
Ambtenaren en sociale media: gevoelige zaak of opportuniteit
Ambtenaren en sociale media: gevoelige zaak of opportuniteitAmbtenaren en sociale media: gevoelige zaak of opportuniteit
Ambtenaren en sociale media: gevoelige zaak of opportuniteit
Vanden Broele
 
Доклад по системе подготовки кадров
Доклад по системе подготовки кадровДоклад по системе подготовки кадров
Доклад по системе подготовки кадров
ё-ИНЖИНИРИНГ
 
Testing Slideshare
Testing SlideshareTesting Slideshare
Testing Slideshare
jenraider
 
FINAL SUBMITTED PAPER-TRENDS IN RENEWABLE ENERGY RESOURES AND THEIR APPLICATIONS
FINAL SUBMITTED PAPER-TRENDS IN RENEWABLE ENERGY RESOURES AND THEIR APPLICATIONSFINAL SUBMITTED PAPER-TRENDS IN RENEWABLE ENERGY RESOURES AND THEIR APPLICATIONS
FINAL SUBMITTED PAPER-TRENDS IN RENEWABLE ENERGY RESOURES AND THEIR APPLICATIONS
Navneet Agarwal
 
Cashflow secrets how we generate 6% per month with minimum risk!
Cashflow secrets  how we generate 6% per month with minimum risk! Cashflow secrets  how we generate 6% per month with minimum risk!
Cashflow secrets how we generate 6% per month with minimum risk!
Duane Cunningham
 

En vedette (15)

Goede praktijken in overheidscommunicatie 2.0
Goede praktijken in overheidscommunicatie 2.0Goede praktijken in overheidscommunicatie 2.0
Goede praktijken in overheidscommunicatie 2.0
 
ё-ИНЖИНИРИНГ
ё-ИНЖИНИРИНГё-ИНЖИНИРИНГ
ё-ИНЖИНИРИНГ
 
Linux
LinuxLinux
Linux
 
Ambtenaren en sociale media: gevoelige zaak of opportuniteit
Ambtenaren en sociale media: gevoelige zaak of opportuniteitAmbtenaren en sociale media: gevoelige zaak of opportuniteit
Ambtenaren en sociale media: gevoelige zaak of opportuniteit
 
Доклад по системе подготовки кадров
Доклад по системе подготовки кадровДоклад по системе подготовки кадров
Доклад по системе подготовки кадров
 
Testing Slideshare
Testing SlideshareTesting Slideshare
Testing Slideshare
 
FOSS_GNU/Linux
FOSS_GNU/LinuxFOSS_GNU/Linux
FOSS_GNU/Linux
 
TeQuiz - a Tech Quiz
TeQuiz - a Tech QuizTeQuiz - a Tech Quiz
TeQuiz - a Tech Quiz
 
Ficheiro de ortografia
Ficheiro de ortografiaFicheiro de ortografia
Ficheiro de ortografia
 
FINAL SUBMITTED PAPER-TRENDS IN RENEWABLE ENERGY RESOURES AND THEIR APPLICATIONS
FINAL SUBMITTED PAPER-TRENDS IN RENEWABLE ENERGY RESOURES AND THEIR APPLICATIONSFINAL SUBMITTED PAPER-TRENDS IN RENEWABLE ENERGY RESOURES AND THEIR APPLICATIONS
FINAL SUBMITTED PAPER-TRENDS IN RENEWABLE ENERGY RESOURES AND THEIR APPLICATIONS
 
ё-ENGINEERING
ё-ENGINEERINGё-ENGINEERING
ё-ENGINEERING
 
Openstreetmap presentation of Mapping Party at FSMK camp
Openstreetmap presentation of Mapping Party at FSMK campOpenstreetmap presentation of Mapping Party at FSMK camp
Openstreetmap presentation of Mapping Party at FSMK camp
 
Cashflow secrets how we generate 6% per month with minimum risk!
Cashflow secrets  how we generate 6% per month with minimum risk! Cashflow secrets  how we generate 6% per month with minimum risk!
Cashflow secrets how we generate 6% per month with minimum risk!
 
Linux administration
Linux administrationLinux administration
Linux administration
 
Overheidscommunicatie 2.0
Overheidscommunicatie 2.0Overheidscommunicatie 2.0
Overheidscommunicatie 2.0
 

Similaire à Programming c sharp 3rd ch6 7 21

CPP-overviews notes variable data types notes
CPP-overviews notes variable data types notesCPP-overviews notes variable data types notes
CPP-overviews notes variable data types notes
SukhpreetSingh519414
 
An Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAn Overview Of Python With Functional Programming
An Overview Of Python With Functional Programming
Adam Getchell
 
cppt-170218053903 (1).pptx
cppt-170218053903 (1).pptxcppt-170218053903 (1).pptx
cppt-170218053903 (1).pptx
WatchDog13
 
Whats New In C# 4 0 - NetPonto
Whats New In C# 4 0 - NetPontoWhats New In C# 4 0 - NetPonto
Whats New In C# 4 0 - NetPonto
Paulo Morgado
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
Satish Verma
 
Visual Studio 2010 and .NET 4.0 Overview
Visual Studio 2010 and .NET 4.0 OverviewVisual Studio 2010 and .NET 4.0 Overview
Visual Studio 2010 and .NET 4.0 Overview
bwullems
 

Similaire à Programming c sharp 3rd ch6 7 21 (20)

CPP-overviews notes variable data types notes
CPP-overviews notes variable data types notesCPP-overviews notes variable data types notes
CPP-overviews notes variable data types notes
 
An Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAn Overview Of Python With Functional Programming
An Overview Of Python With Functional Programming
 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
 
Basics of c++
Basics of c++Basics of c++
Basics of c++
 
Virtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.pptVirtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.ppt
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
Python and You Series
Python and You SeriesPython and You Series
Python and You Series
 
cppt-170218053903 (1).pptx
cppt-170218053903 (1).pptxcppt-170218053903 (1).pptx
cppt-170218053903 (1).pptx
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
Whats New In C# 4 0 - NetPonto
Whats New In C# 4 0 - NetPontoWhats New In C# 4 0 - NetPonto
Whats New In C# 4 0 - NetPonto
 
C++ Interview Question And Answer
C++ Interview Question And AnswerC++ Interview Question And Answer
C++ Interview Question And Answer
 
C++ questions And Answer
C++ questions And AnswerC++ questions And Answer
C++ questions And Answer
 
Unit v
Unit vUnit v
Unit v
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
Lambdas & Streams
Lambdas & StreamsLambdas & Streams
Lambdas & Streams
 
C++ Overview PPT
C++ Overview PPTC++ Overview PPT
C++ Overview PPT
 
C++
C++C++
C++
 
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersMSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
 
C++ language
C++ languageC++ language
C++ language
 
Visual Studio 2010 and .NET 4.0 Overview
Visual Studio 2010 and .NET 4.0 OverviewVisual Studio 2010 and .NET 4.0 Overview
Visual Studio 2010 and .NET 4.0 Overview
 

Dernier

Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
fonyou31
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 

Dernier (20)

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 

Programming c sharp 3rd ch6 7 21

  • 1. Programming C#, 3rd Edition Introduction (part 1) 寶來 資工部 簡伯松 PoSung Chien (Poisson)
  • 2.
  • 3.
  • 4.
  • 5. Arithmetic operators ( 算數運算 ) Operator name Syntax Overloadable Basic assignment a = b No Addition a + b Yes Subtraction a - b Yes Unary plus (integer promotion) + a Yes Unary minus (additive inverse) - a Yes Multiplication a * b Yes Division a / b Yes Modulo (remainder) a % b Yes Increment ++ a, a ++ Yes Decrement -- a, a -- Yes
  • 6. Comparison operators / Relational operators ( 比較運算 ) Operator name Syntax Overloadable Equal to a == b Yes Not equal to a != b Yes Greater than a > b Yes Less than a < b Yes Greater than or equal to a >= b Yes Less than or equal to a <= b Yes
  • 7. Logical operators ( 邏輯運算 ) Operator name Syntax Overloadable Logical negation (NOT) ! a Yes Logical AND a && b Yes Logical OR a || b Yes
  • 8. Bitwise operators ( 位元運算 ) Operator name Syntax Overloadable Bitwise NOT ~ a Yes Bitwise AND a & b Yes Bitwise OR a | b Yes Bitwise XOR a ^ b Yes Bitwise left shift a << b Yes Bitwise right shift a >> b Yes
  • 9. Compound-assignment operators ( 複合賦值 ) Operator name Syntax Overloadable Addition assignment a += b Yes Subtraction assignment a -= b Yes Multiplication assignment a *= b Yes Division assignment a /= b Yes Modulo assignment a %= b Yes Bitwise AND assignment a &= b Yes Bitwise OR assignment a |= b Yes Bitwise XOR assignment a ^= b Yes Bitwise left shift assignment a <<= b Yes Bitwise right shift assignment a >>= b Yes
  • 10. Member and pointer operators ( 成員及指標 ) Operator name Syntax Overloadable Array subscript a [ b ] Yes Indirection (&quot;variable pointed to by a &quot;) * a No Reference (&quot;address of a &quot;) & a No Member b of object pointed to by a (unsafe) a -> b No Member b of object a a . b No Member pointed to by b of object pointed to by a (unsafe) a ->* b No Member pointed to by b of object a (unsafe) a .* b No
  • 11. Other operators ( 其它 ) Operator name Syntax Overloadable Function call See Function object . a ( a1, a2 ) Yes is operator object is string No True / False true, false Yes Ternary conditional a ? b : c No Size-of sizeof (a) sizeof ( type ) No Type identification typeof (a) typeof ( type ) No Cast (implicit, explicit) ( type ) a Yes Allocate storage new type No
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 32. Reading or Writing Class Use Stream Abstract class that supports reading and writing bytes. BinaryReader/ BinaryWriter Read and write encoded strings and primitive datatypes to and from streams. File , FileInfo , Directory , DirectoryInfo Provide implementations for the abstract FileSystemInfo classes, including creating, moving, renaming, and deleting files and directories. FileStream For reading to and from File objects; supports random access to files. Opens files synchronously by default; supports asynchronous file access. TextReader , T ex tWriter , StringReader , S t ringWriter TextReader and TextWriter are abstract classes designed for Unicode character I/O. StringReader and StringWriter write to and from strings, allowing your input and output to be either a stream or a string.
  • 33. Reading or Writing (cont.) Class Use BufferedStream A stream that adds buffering to another stream such as a NetworkStream . Note that FileStream has buffering built in. BufferedStreams can improve performance of the stream to which they are attached. MemoryStream A nonbuffered stream whose encapsulated data is directly accessible in memory. A MemoryStream has no backing store, and is most useful as a temporary buffer. NetworkStream A stream over a network connection.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.

Notes de l'éditeur

  1. Reference : http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Reference : http://msdn.microsoft.com/zh-tw/library/8edha89s(VS.80).aspx
  2. Reference : http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Reference : http://msdn.microsoft.com/zh-tw/library/8edha89s(VS.80).aspx
  3. Reference : http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Reference : http://msdn.microsoft.com/zh-tw/library/8edha89s(VS.80).aspx
  4. Reference : http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Reference : http://msdn.microsoft.com/zh-tw/library/8edha89s(VS.80).aspx
  5. Reference : http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Reference : http://msdn.microsoft.com/zh-tw/library/8edha89s(VS.80).aspx
  6. Reference : http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Reference : http://msdn.microsoft.com/zh-tw/library/8edha89s(VS.80).aspx
  7. Reference : http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Reference : http://msdn.microsoft.com/zh-tw/library/8edha89s(VS.80).aspx
  8. Reference : 不可多載的運算子 in c# http://msdn.microsoft.com/zh-tw/library/8edha89s(VS.80).aspx
  9. Reference : http://msdn.microsoft.com/zh-tw/library/7bxsh36e%28v=VS.90%29.aspx 編譯器錯誤 CS0216 Reference : http://msdn.microsoft.com/zh-tw/library/4wtxwb6k%28VS.80%29.aspx 編譯器警告 ( 層級 3) CS0660
  10. Reference : http://lagunawang.pixnet.net/blog/post/20160001
  11. Reference : http://msdn.microsoft.com/zh-tw/library/saxz13w4%28v=vs.80%29.aspx The stack is always used to store the following two things: The reference portion of reference-typed local variables and parameters (such as the myTextBox reference ) Value-typed local variables and method parameters (structs, as well as integer s, bool s, char s, DateTime s, etc.) The following data is stored on the heap: The content of reference-type objects. Anything structured inside a reference-type object. 只要 struct 是放在 class 裡 這個 struct 也是會被放在 Heap 而不是 Stack. struct 裡面有 class 的話, struct 會存在 Stack 裡,而其中有一個 指標指到 Heap 中 class 。 Class 裡面有 struct 的話, stack 裡只會在 class 的指標,而 struct 會存在 Heap 中的 Class 裡
  12. Reference : http://msdn.microsoft.com/zh-tw/library/ah19swz4%28v=vs.80%29.aspx Reference : http://msdn.microsoft.com/en-us/library/ah19swz4%28v=vs.71%29.aspx [attributes] : public, private
  13. Reference : http://stackoverflow.com/questions/3146586/directory-vs-directoryinfo
  14. Reference : http://msdn.microsoft.com/zh-tw/library/system.io.directoryinfo_methods%28v=VS.80%29.aspx public static IEnumerable&lt;string&gt; EnumerateDirectories( string path ) public IEnumerable&lt;FileInfo&gt; EnumerateFiles() public FileSystemInfo[] GetFileSystemInfos ( string searchPattern ) public static string[] GetDirectories ( string path )
  15. 先用 stream 打開檔案,再用 BufferedStream 來承接, 之後我們就對 BufferedStream 做操作既可。