SlideShare a Scribd company logo
1 of 63
James Michael Hare 2011 Visual C# MVP Application Architect Scottrade August 5 th , 2011 Blog: http://www.BlackRabbitCoder.net Twitter: @BlkRabbitCoder
The joys of managed code ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
But, there is a catch… ,[object Object],[object Object],[object Object],[object Object],[object Object]
Today’s Little Pitfalls: ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Converting boxed values ,[object Object],[object Object],[object Object],[object Object]
Creating unnecessary strings ,[object Object],[object Object],[object Object]
Creating unnecessary strings ,[object Object],[object Object],[object Object],[object Object]
Creating unnecessary strings ,[object Object],[object Object],[object Object],[object Object],[object Object]
Nullable<T>  arithmetic ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Nullable<T>  arithmetic ,[object Object],[object Object],[object Object],[object Object]
Nullable<T>  arithmetic ,[object Object]
Nullable<T>  arithmetic ,[object Object],[object Object],[object Object],[object Object],[object Object]
Nullable<T>  arithmetic ,[object Object],[object Object],[object Object],[object Object]
Nullable<T>  arithmetic ,[object Object]
Nullable<T>  comparisons ,[object Object],[object Object],[object Object],[object Object]
Nullable<T>  comparisons ,[object Object]
Nullable<T>  comparisons ,[object Object],[object Object],[object Object],[object Object]
Mutable  readonly  values ,[object Object],[object Object],[object Object]
Mutable  readonly  values ,[object Object],[object Object],[object Object],[object Object]
Mutable  readonly  values ,[object Object],[object Object],[object Object],[object Object]
Mutable  readonly  values ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
const  values are  compile-time ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
const  values are  compile-time ,[object Object],[object Object]
const  values are  compile-time ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
const  values are  compile-time ,[object Object],[object Object],[object Object],[object Object]
Operators are  overloaded ,[object Object],[object Object],[object Object],[object Object]
Operators are  overloaded ,[object Object],[object Object]
Operators are  overloaded ,[object Object],[object Object],[object Object]
Operators are  overloaded ,[object Object],[object Object],[object Object],[object Object]
Hiding is the default ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Hiding is the default ,[object Object]
Hiding is the default ,[object Object],[object Object]
Hiding is the default ,[object Object],[object Object],[object Object]
Default parameters ,[object Object],[object Object],[object Object]
Default parameters ,[object Object],[object Object],[object Object],[object Object],[object Object]
Default parameters ,[object Object]
Default parameters ,[object Object],[object Object],[object Object],[object Object],[object Object]
Default parameters ,[object Object],[object Object],[object Object],[object Object]
A  struct  is not a  class ,[object Object],[object Object],[object Object],[object Object]
A  struct  is not a  class ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
A  struct  is not a  class ,[object Object],[object Object]
A  struct  is not a  class ,[object Object],[object Object],[object Object],[object Object]
A  struct  is not a  class ,[object Object]
A  struct  is not a  class ,[object Object]
A  struct  is not a  class ,[object Object],[object Object],[object Object]
A  struct  is not a  class ,[object Object],[object Object],[object Object],[object Object],[object Object]
Initialization Order ,[object Object],[object Object],[object Object],[object Object]
Initialization Order ,[object Object],[object Object]
Initialization Order ,[object Object]
Initialization Order ,[object Object],[object Object]
Initialization Order ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Premature polymorphism ,[object Object],[object Object]
Premature polymorphism ,[object Object]
Premature polymorphism ,[object Object],[object Object]
Premature polymorphism ,[object Object],[object Object],[object Object]
Premature polymorphism ,[object Object],[object Object],[object Object]
Unconstrained generics ,[object Object],[object Object],[object Object]
Unconstrained generics ,[object Object],[object Object],[object Object]
Unconstrained generics ,[object Object],[object Object],[object Object],[object Object],[object Object]
Unconstrained generics ,[object Object],[object Object]
Conclusion ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Questions?
 

More Related Content

What's hot (6)

怎樣才算是一個合格的資工系畢業生
怎樣才算是一個合格的資工系畢業生怎樣才算是一個合格的資工系畢業生
怎樣才算是一個合格的資工系畢業生
 
用十分鐘 瞭解《圖靈獎得主》的學術貢獻
用十分鐘  瞭解《圖靈獎得主》的學術貢獻用十分鐘  瞭解《圖靈獎得主》的學術貢獻
用十分鐘 瞭解《圖靈獎得主》的學術貢獻
 
開放電腦計畫 - 從一顆最簡單的 MCU 談起
開放電腦計畫  - 從一顆最簡單的 MCU 談起開放電腦計畫  - 從一顆最簡單的 MCU 談起
開放電腦計畫 - 從一顆最簡單的 MCU 談起
 
用十分鐘瞭解陳鍾誠的 《課程、教材與學習方法》
用十分鐘瞭解陳鍾誠的  《課程、教材與學習方法》用十分鐘瞭解陳鍾誠的  《課程、教材與學習方法》
用十分鐘瞭解陳鍾誠的 《課程、教材與學習方法》
 
Clean Code
Clean CodeClean Code
Clean Code
 
Exploitation of counter overflows in the Linux kernel
Exploitation of counter overflows in the Linux kernelExploitation of counter overflows in the Linux kernel
Exploitation of counter overflows in the Linux kernel
 

Similar to C#/.NET Little Pitfalls

Macasu, gerrell c.
Macasu, gerrell c.Macasu, gerrell c.
Macasu, gerrell c.
gerrell
 
Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!
olracoatalub
 

Similar to C#/.NET Little Pitfalls (20)

More Little Wonders of C#/.NET
More Little Wonders of C#/.NETMore Little Wonders of C#/.NET
More Little Wonders of C#/.NET
 
Can't Dance The Lambda
Can't Dance The LambdaCan't Dance The Lambda
Can't Dance The Lambda
 
The Little Wonders of C# 6
The Little Wonders of C# 6The Little Wonders of C# 6
The Little Wonders of C# 6
 
EuroAD 2021: ChainRules.jl
EuroAD 2021: ChainRules.jl EuroAD 2021: ChainRules.jl
EuroAD 2021: ChainRules.jl
 
My final requirement
My final requirementMy final requirement
My final requirement
 
Basics of kotlin ASJ
Basics of kotlin ASJBasics of kotlin ASJ
Basics of kotlin ASJ
 
Good Coding Practices with JavaScript
Good Coding Practices with JavaScriptGood Coding Practices with JavaScript
Good Coding Practices with JavaScript
 
2.Getting Started with C#.Net-(C#)
2.Getting Started with C#.Net-(C#)2.Getting Started with C#.Net-(C#)
2.Getting Started with C#.Net-(C#)
 
Switch case and looping jam
Switch case and looping jamSwitch case and looping jam
Switch case and looping jam
 
Java script basic
Java script basicJava script basic
Java script basic
 
C++ Interview Questions
C++ Interview QuestionsC++ Interview Questions
C++ Interview Questions
 
The Uniform Access Principle
The Uniform Access PrincipleThe Uniform Access Principle
The Uniform Access Principle
 
Macasu, gerrell c.
Macasu, gerrell c.Macasu, gerrell c.
Macasu, gerrell c.
 
100% code coverage by static analysis - is it that good?
100% code coverage by static analysis - is it that good?100% code coverage by static analysis - is it that good?
100% code coverage by static analysis - is it that good?
 
Switch case and looping new
Switch case and looping newSwitch case and looping new
Switch case and looping new
 
Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!
 
About Functional Programming
About Functional ProgrammingAbout Functional Programming
About Functional Programming
 
JavaScripts internals #1
JavaScripts internals #1JavaScripts internals #1
JavaScripts internals #1
 
Tcs NQTExam technical questions
Tcs NQTExam technical questionsTcs NQTExam technical questions
Tcs NQTExam technical questions
 
Something for Nothing
Something for NothingSomething for Nothing
Something for Nothing
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

C#/.NET Little Pitfalls

  • 1. James Michael Hare 2011 Visual C# MVP Application Architect Scottrade August 5 th , 2011 Blog: http://www.BlackRabbitCoder.net Twitter: @BlkRabbitCoder
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 63.