SlideShare une entreprise Scribd logo
1  sur  26
Phil Denoncourt
phil@denoncourtassociates.com
http://philknows.net
» Desktops
˃ WinForm
˃ WPF
˃ Linux, Mac, Solaris
» Servers
˃ Web Apps
˃ Services (web/native)
» Embedded Systems
˃ Micro .NET (Netduino, FEZ Domino)
˃ Windows Phone
˃ Robots
˃ iPhone
» Gaming Consoles
˃ Xbox 360
˃ Wii, Playstation 3 (via Mono)
2
25 Things I've Learned about C# - Phil Denoncourt
http://mono-project.com
» C# compiles to bytecode
˃ So it must be slow
» Bytecode gets compiled to native code upon
first usage
˃ Takes advantage of features that machine’s processor
» Matches C++ in Int math, trig, and I/O.
˃ Little slower in floating point
» C# benefits from disposing of objects when idle
˃ rather than when object is no longer used.
» http://www.osnews.com/story/5602&page=3
3
25 Things I've Learned about C# - Phil Denoncourt
» Built into the framework since 3.0
˃ Add reference to System.Speech
» Recognition
˃ Command based
˃ Dictation
» Synthesis
» Requires SAPI
˃ Windows Vista and Later
˃ Office 2003 and Later
» http://gotspeech.net
4
25 Things I've Learned about C# - Phil Denoncourt
» It’s easy to write
˃ ThreadPool.QueueUserWorkItem
˃ PLINQ
˃ BackgroundWorker component
» It’s hard to debug
˃ Add trace / logging to your code
» Make sure your classes are “ThreadSafe”
˃ Lock keyword
˃ Interlocked class
» http://www.bluebytesoftware.com/blog/
5
25 Things I've Learned about C# - Phil Denoncourt
» Added in 3.0. Implemented as a generic class
˃ Allows you to consider value types that are nullable
» Add ? to end of type
˃ Int?
˃ DateTime?
˃ String is already a reference type, thus already nullable
» Null Coalesce operator
˃ Substitutes a value if the object is null
˃ Really low in operator precedence. Often need parens.
» http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx
6
25 Things I've Learned about C# - Phil Denoncourt
» Exceptions hold a lot of information
» Throwing them is computationally expensive
˃ Avoid using exceptions as logic flow
» Stack trace line numbers are available if PDBs
are present with the binaries
» There is a difference between
˃ throw
˃ throw ex;
» http://msdn.microsoft.com/en-
us/library/5b2yeyab(v=VS.100).aspx
7
25 Things I've Learned about C# - Phil Denoncourt
» checked
˃ By default, overflow checking is disabled in C#
+ Depending on compiler options
˃ Placing statements in checked block enables checking
˃ There is also an unchecked keyword
˃ http://msdn.microsoft.com/en-us/library/74b4xzyw(v=VS.100).aspx
» volatile
˃ Keyword that indicates field could be updated by multiple threads
+ Disables compiler optimizations that assume single threaded access
˃ Places a “lock” statement around access to the field
˃ http://msdn.microsoft.com/en-us/library/x13ttww7(v=VS.100).aspx
8
25 Things I've Learned about C# - Phil Denoncourt
» Allows you to add new methods to existing classes
˃ Even sealed classes
» Can operate on public members
˃ But not private members
» Good way to add “missing” functionality to class
˃ Good way to make something unmaintainable
» Internally – implemented as a static method
passing in the current instance.
» http://extensionmethod.net/
9
25 Things I've Learned about C# - Phil Denoncourt
» Generic template that defers initialization until
used
» System.Lazy<T>
» Object will be initialized when the value
member is accessed, or ToString() is called.
» http://weblogs.asp.net/gunnarpeipman/archive/2009/05/19/net-framework-4-0-using-system-lazy-lt-t-gt.aspx
10
25 Things I've Learned about C# - Phil Denoncourt
» Lambda operator =>
» Anonymous function
˃ Contains code
» Returns a delegate
» Used extensively in Linq
» http://msdn.microsoft.com/en-
us/library/bb311046.aspx
11
25 Things I've Learned about C# - Phil Denoncourt
» Eliminates a lot of repetitive coding
» Implemented as extension methods in
System.Linq.dll
» Must reference the assembly, and add a using
statement:
˃ using System.Linq;
» Different providers allow access to different types
of data by exposing IQueryable interface
˃ Linq to Objects
˃ Linq to SQL
˃ Linq to Entities
˃ Linq to Xml
» http://msdn.microsoft.com/en-us/netframework/aa904594.aspx
12
25 Things I've Learned about C# - Phil Denoncourt
» Normally static fields exist once per AppDomain
» [ThreadStatic] static fields exist once per Thread
» Static constructors and initializers still only
execute once.
˃ So you have to make sure the object is not null before using it
» http://blogs.msdn.com/b/jfoscoding/archive/2006/07/18/670497.
aspx
13
25 Things I've Learned about C# - Phil Denoncourt
» Allows you to move a class from one assembly
to another without breaking callers
» [assembly:TypeForwardedTo(typeof(classThatWasMoved)]
˃ Place this statement in the original assembly, which must reference
the new assembly.
» Used for refactoring types into different
assemblies, and not have to rebuild the caller
assembly.
˃ Namespace and name can’t change
» Can also redirect entire assembly in .config file
˃ assemblyBinding section
» http://msdn.microsoft.com/en-us/library/ms404275.aspx
14
25 Things I've Learned about C# - Phil Denoncourt
» Don’t need to be based on int
˃ Can be byte, sbyte, short, ushort, int, uint, long, or ulong.
» If you use the FlagsAttribute, you can perform
bitwise operations
˃ Meaning that you can store more than one state in an enum variable.
» http://dotnetperls.com/enum-flags
15
25 Things I've Learned about C# - Phil Denoncourt
» -In addition to allowing shortcuts to
namespaces
» Automatically disposes objects when scope is
outside of the using statement.
» Object doesn’t need to be instantiated in the
using statement
˃ But should
» More than one object can be tracked by a using
statement
˃ But they must be of the same type
» http://msdn.microsoft.com/en-us/library/yh598w02.aspx
16
25 Things I've Learned about C# - Phil Denoncourt
» Allows you to examine metadata about
compiled code.
» Has a reputation for being slow
˃ I haven’t found that to be very true
» Allows access to private methods / fields of a
class
» You can also get the actual IL of the method for
reverse engineering
˃ Which is what Reflector does
» http://msdn.microsoft.com/en-us/library/f7ykdhsy(v=VS.100).aspx
17
25 Things I've Learned about C# - Phil Denoncourt
» Can call other constructor methods
˃ Add :this to call a constructor in the current object
˃ Add :base to call a constructor in the base object
» http://msdn.microsoft.com/en-us/library/ms173115.aspx
18
25 Things I've Learned about C# - Phil Denoncourt
» Allows you to write code against an abstract type
˃ Type Parameter
» When generic is used, a type is specified.
˃ Reduces the amount of boxing
» Generics can be applied to
˃ Classes
˃ Delegates
˃ Methods
˃ Interfaces
» Instead of comparing to null, compare to default(t)
» http://msdn.microsoft.com/en-
us/library/512aeb7t(v=VS.100).aspx
19
25 Things I've Learned about C# - Phil Denoncourt
» Allows you to constrain what types can be used
with a generic
» Can constrain
˃ Classes that implement an interface
˃ Classes must have a common base class
˃ Parameterless constructor
˃ That the type is a class
˃ That the type is a struct
» Constraints enforced by the compiler
» http://msdn.microsoft.com/en-us/library/d5x73970.aspx
20
25 Things I've Learned about C# - Phil Denoncourt
» Very easy since .NET 2.0
˃ No more worrying about holding onto disposable objects
» File class – static methods for
˃ Copying
˃ Renaming
˃ Deleting
˃ Checking existing
˃ Reading /writing data to a file
˃ Encrypt/Decrypt a file
˃ http://msdn.microsoft.com/en-us/library/system.io.file.aspx
» Path class – static methods for
˃ Assembling a filename
˃ Changing extensions
˃ Getting a truly temporary filename
˃ http://msdn.microsoft.com/en-us/library/system.io.path.aspx
21
25 Things I've Learned about C# - Phil Denoncourt
» Mostly done for you
» .NET 4.0 supports 354 different cultures
» Allows you to properly
˃ Format numbers
˃ Format currency
˃ Format date/times
˃ Compare strings
» By default, the culture of the current thread is used
when formatting/comparing
» Globalization != Localization
» http://en.wikibooks.org/wiki/.NET_Development_Foundation/Glo
balization
22
25 Things I've Learned about C# - Phil Denoncourt
» You can write code that writes code
» Emits C# or VB.Net
» Or can build an assembly using a compiler
» Can build the assembly in memory
˃ Doesn’t get written to disk.
» http://www.15seconds.com/issue/020917.htm
23
25 Things I've Learned about C# - Phil Denoncourt
» GZipStream class only compresses one file
» System.IO.Packaging
˃ Add reference to “WindowsBase”
» Add each file as part of the package
» It will add a [Content_Types].xml file to every
zip file
˃ Part of the open packaging specification
» http://madprops.org/blog/zip-your-streams-with-system-io-
packaging/
24
25 Things I've Learned about C# - Phil Denoncourt
» Goto in switch statement
» >> multiplies by powers of 2, << divides
˃ Real fast
» as operator
˃ Faster than cast, doesn’t throw exception
» @ string constant qualifier
˃ Ignores  escapes
» StringBuilder concatenates strings faster
˃ For only for large amounts of data
25
25 Things I've Learned about C# - Phil Denoncourt
» Code Access Security
» Strong names
» Lackluster support for Xml Documentation
» Lack of development in certain libraries
˃ Linq to SQL
˃ ASP.NET
26
25 Things I've Learned about C# - Phil Denoncourt

Contenu connexe

Tendances

Getting root with benign app store apps
Getting root with benign app store appsGetting root with benign app store apps
Getting root with benign app store appsCsaba Fitzl
 
Mitigating Exploits Using Apple's Endpoint Security
Mitigating Exploits Using Apple's Endpoint SecurityMitigating Exploits Using Apple's Endpoint Security
Mitigating Exploits Using Apple's Endpoint SecurityCsaba Fitzl
 
Power on, Powershell
Power on, PowershellPower on, Powershell
Power on, PowershellRoo7break
 
From Problem to Solution: Enumerating Windows Firewall-Hook Drivers
From Problem to Solution: Enumerating Windows Firewall-Hook DriversFrom Problem to Solution: Enumerating Windows Firewall-Hook Drivers
From Problem to Solution: Enumerating Windows Firewall-Hook DriversOllie Whitehouse
 
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...CODE BLUE
 
Red Team Tactics for Cracking the GSuite Perimeter
Red Team Tactics for Cracking the GSuite PerimeterRed Team Tactics for Cracking the GSuite Perimeter
Red Team Tactics for Cracking the GSuite PerimeterMike Felch
 
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru Otsuka
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru OtsukaTake a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru Otsuka
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru OtsukaCODE BLUE
 
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...Hackito Ergo Sum
 
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...CODE BLUE
 
bh-us-02-murphey-freebsd
bh-us-02-murphey-freebsdbh-us-02-murphey-freebsd
bh-us-02-murphey-freebsdwebuploader
 
Possibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented ProgrammingPossibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented Programmingkozossakai
 
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit MitigationsCaptain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit MitigationsenSilo
 
PowerShell Inside Out: Applied .NET Hacking for Enhanced Visibility by Satosh...
PowerShell Inside Out: Applied .NET Hacking for Enhanced Visibility by Satosh...PowerShell Inside Out: Applied .NET Hacking for Enhanced Visibility by Satosh...
PowerShell Inside Out: Applied .NET Hacking for Enhanced Visibility by Satosh...CODE BLUE
 
Steelcon 2014 - Process Injection with Python
Steelcon 2014 - Process Injection with PythonSteelcon 2014 - Process Injection with Python
Steelcon 2014 - Process Injection with Pythoninfodox
 
Injection on Steroids: Codeless code injection and 0-day techniques
Injection on Steroids: Codeless code injection and 0-day techniquesInjection on Steroids: Codeless code injection and 0-day techniques
Injection on Steroids: Codeless code injection and 0-day techniquesenSilo
 
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Codemotion
 
Owning computers without shell access 2
Owning computers without shell access 2Owning computers without shell access 2
Owning computers without shell access 2Royce Davis
 
Cloud Device Insecurity
Cloud Device InsecurityCloud Device Insecurity
Cloud Device InsecurityJeremy Brown
 
[CB17] Trueseeing: Effective Dataflow Analysis over Dalvik Opcodes
[CB17] Trueseeing: Effective Dataflow Analysis over Dalvik Opcodes[CB17] Trueseeing: Effective Dataflow Analysis over Dalvik Opcodes
[CB17] Trueseeing: Effective Dataflow Analysis over Dalvik OpcodesCODE BLUE
 

Tendances (20)

Getting root with benign app store apps
Getting root with benign app store appsGetting root with benign app store apps
Getting root with benign app store apps
 
Mitigating Exploits Using Apple's Endpoint Security
Mitigating Exploits Using Apple's Endpoint SecurityMitigating Exploits Using Apple's Endpoint Security
Mitigating Exploits Using Apple's Endpoint Security
 
Power on, Powershell
Power on, PowershellPower on, Powershell
Power on, Powershell
 
From Problem to Solution: Enumerating Windows Firewall-Hook Drivers
From Problem to Solution: Enumerating Windows Firewall-Hook DriversFrom Problem to Solution: Enumerating Windows Firewall-Hook Drivers
From Problem to Solution: Enumerating Windows Firewall-Hook Drivers
 
Back to the CORE
Back to the COREBack to the CORE
Back to the CORE
 
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
 
Red Team Tactics for Cracking the GSuite Perimeter
Red Team Tactics for Cracking the GSuite PerimeterRed Team Tactics for Cracking the GSuite Perimeter
Red Team Tactics for Cracking the GSuite Perimeter
 
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru Otsuka
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru OtsukaTake a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru Otsuka
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru Otsuka
 
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
 
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
 
bh-us-02-murphey-freebsd
bh-us-02-murphey-freebsdbh-us-02-murphey-freebsd
bh-us-02-murphey-freebsd
 
Possibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented ProgrammingPossibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented Programming
 
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit MitigationsCaptain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
 
PowerShell Inside Out: Applied .NET Hacking for Enhanced Visibility by Satosh...
PowerShell Inside Out: Applied .NET Hacking for Enhanced Visibility by Satosh...PowerShell Inside Out: Applied .NET Hacking for Enhanced Visibility by Satosh...
PowerShell Inside Out: Applied .NET Hacking for Enhanced Visibility by Satosh...
 
Steelcon 2014 - Process Injection with Python
Steelcon 2014 - Process Injection with PythonSteelcon 2014 - Process Injection with Python
Steelcon 2014 - Process Injection with Python
 
Injection on Steroids: Codeless code injection and 0-day techniques
Injection on Steroids: Codeless code injection and 0-day techniquesInjection on Steroids: Codeless code injection and 0-day techniques
Injection on Steroids: Codeless code injection and 0-day techniques
 
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
 
Owning computers without shell access 2
Owning computers without shell access 2Owning computers without shell access 2
Owning computers without shell access 2
 
Cloud Device Insecurity
Cloud Device InsecurityCloud Device Insecurity
Cloud Device Insecurity
 
[CB17] Trueseeing: Effective Dataflow Analysis over Dalvik Opcodes
[CB17] Trueseeing: Effective Dataflow Analysis over Dalvik Opcodes[CB17] Trueseeing: Effective Dataflow Analysis over Dalvik Opcodes
[CB17] Trueseeing: Effective Dataflow Analysis over Dalvik Opcodes
 

En vedette

Poster Competition - Hwan Lee
Poster Competition - Hwan LeePoster Competition - Hwan Lee
Poster Competition - Hwan LeeHwan Lee
 
Writing applications using the Microsoft Kinect Sensor
Writing applications using the Microsoft Kinect SensorWriting applications using the Microsoft Kinect Sensor
Writing applications using the Microsoft Kinect Sensorphildenoncourt
 
Building your own arcade cabinet
Building your own arcade cabinetBuilding your own arcade cabinet
Building your own arcade cabinetphildenoncourt
 
Unama br edinaldo_la-roque_oficina_kinect_20160917_2030
Unama br edinaldo_la-roque_oficina_kinect_20160917_2030Unama br edinaldo_la-roque_oficina_kinect_20160917_2030
Unama br edinaldo_la-roque_oficina_kinect_20160917_2030la-roque
 
Motion sensing and detection
Motion sensing and detectionMotion sensing and detection
Motion sensing and detectionNirav Soni
 
Monitoring of patient in intensive care unit (ICU)
Monitoring of patient in intensive care unit (ICU)Monitoring of patient in intensive care unit (ICU)
Monitoring of patient in intensive care unit (ICU)Raj Mehta
 
Patient Monitoring
Patient Monitoring	Patient Monitoring
Patient Monitoring Khalid
 
motion sensing technology
motion sensing technologymotion sensing technology
motion sensing technologySantosh Kumar
 

En vedette (8)

Poster Competition - Hwan Lee
Poster Competition - Hwan LeePoster Competition - Hwan Lee
Poster Competition - Hwan Lee
 
Writing applications using the Microsoft Kinect Sensor
Writing applications using the Microsoft Kinect SensorWriting applications using the Microsoft Kinect Sensor
Writing applications using the Microsoft Kinect Sensor
 
Building your own arcade cabinet
Building your own arcade cabinetBuilding your own arcade cabinet
Building your own arcade cabinet
 
Unama br edinaldo_la-roque_oficina_kinect_20160917_2030
Unama br edinaldo_la-roque_oficina_kinect_20160917_2030Unama br edinaldo_la-roque_oficina_kinect_20160917_2030
Unama br edinaldo_la-roque_oficina_kinect_20160917_2030
 
Motion sensing and detection
Motion sensing and detectionMotion sensing and detection
Motion sensing and detection
 
Monitoring of patient in intensive care unit (ICU)
Monitoring of patient in intensive care unit (ICU)Monitoring of patient in intensive care unit (ICU)
Monitoring of patient in intensive care unit (ICU)
 
Patient Monitoring
Patient Monitoring	Patient Monitoring
Patient Monitoring
 
motion sensing technology
motion sensing technologymotion sensing technology
motion sensing technology
 

Similaire à 25 things i’ve learned about c#

C++ Windows Forms L01 - Intro
C++ Windows Forms L01 - IntroC++ Windows Forms L01 - Intro
C++ Windows Forms L01 - IntroMohammad Shaker
 
Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...
Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...
Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...PranavPatil822557
 
Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?AFUP_Limoges
 
Going All-In With Go For CLI Apps
Going All-In With Go For CLI AppsGoing All-In With Go For CLI Apps
Going All-In With Go For CLI AppsTom Elliott
 
Bounded Model Checking for C Programs in an Enterprise Environment
Bounded Model Checking for C Programs in an Enterprise EnvironmentBounded Model Checking for C Programs in an Enterprise Environment
Bounded Model Checking for C Programs in an Enterprise EnvironmentAdaCore
 
The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008Stephan Chenette
 
DevOPS training - Day 2/2
DevOPS training - Day 2/2DevOPS training - Day 2/2
DevOPS training - Day 2/2Vincent Mercier
 
BSides Iowa 2018: Windows COM: Red vs Blue
BSides Iowa 2018: Windows COM: Red vs BlueBSides Iowa 2018: Windows COM: Red vs Blue
BSides Iowa 2018: Windows COM: Red vs BlueAndrew Freeborn
 
Typhoon Managed Execution Toolkit
Typhoon Managed Execution ToolkitTyphoon Managed Execution Toolkit
Typhoon Managed Execution ToolkitDimitry Snezhkov
 
Weave User Group Talk - DockerCon 2017 Recap
Weave User Group Talk - DockerCon 2017 RecapWeave User Group Talk - DockerCon 2017 Recap
Weave User Group Talk - DockerCon 2017 RecapPatrick Chanezon
 
MattsonTutorialSC14.pptx
MattsonTutorialSC14.pptxMattsonTutorialSC14.pptx
MattsonTutorialSC14.pptxgopikahari7
 
Hacking Docker the Easy way
Hacking Docker the Easy wayHacking Docker the Easy way
Hacking Docker the Easy wayBorg Han
 
CNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgCNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgSam Bowne
 
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013midnite_runr
 
On the Edge Systems Administration with Golang
On the Edge Systems Administration with GolangOn the Edge Systems Administration with Golang
On the Edge Systems Administration with GolangChris McEniry
 
DLL Design with Building Blocks
DLL Design with Building BlocksDLL Design with Building Blocks
DLL Design with Building BlocksMax Kleiner
 
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbgPractical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbgSam Bowne
 

Similaire à 25 things i’ve learned about c# (20)

C++ Windows Forms L01 - Intro
C++ Windows Forms L01 - IntroC++ Windows Forms L01 - Intro
C++ Windows Forms L01 - Intro
 
Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...
Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...
Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...
 
Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?
 
Need 4 Speed FI
Need 4 Speed FINeed 4 Speed FI
Need 4 Speed FI
 
Going All-In With Go For CLI Apps
Going All-In With Go For CLI AppsGoing All-In With Go For CLI Apps
Going All-In With Go For CLI Apps
 
Bounded Model Checking for C Programs in an Enterprise Environment
Bounded Model Checking for C Programs in an Enterprise EnvironmentBounded Model Checking for C Programs in an Enterprise Environment
Bounded Model Checking for C Programs in an Enterprise Environment
 
The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008
 
DevOPS training - Day 2/2
DevOPS training - Day 2/2DevOPS training - Day 2/2
DevOPS training - Day 2/2
 
BSides Iowa 2018: Windows COM: Red vs Blue
BSides Iowa 2018: Windows COM: Red vs BlueBSides Iowa 2018: Windows COM: Red vs Blue
BSides Iowa 2018: Windows COM: Red vs Blue
 
Typhoon Managed Execution Toolkit
Typhoon Managed Execution ToolkitTyphoon Managed Execution Toolkit
Typhoon Managed Execution Toolkit
 
Weave User Group Talk - DockerCon 2017 Recap
Weave User Group Talk - DockerCon 2017 RecapWeave User Group Talk - DockerCon 2017 Recap
Weave User Group Talk - DockerCon 2017 Recap
 
MattsonTutorialSC14.pptx
MattsonTutorialSC14.pptxMattsonTutorialSC14.pptx
MattsonTutorialSC14.pptx
 
.NET for hackers
.NET for hackers.NET for hackers
.NET for hackers
 
Hacking Docker the Easy way
Hacking Docker the Easy wayHacking Docker the Easy way
Hacking Docker the Easy way
 
CNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgCNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbg
 
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
 
On the Edge Systems Administration with Golang
On the Edge Systems Administration with GolangOn the Edge Systems Administration with Golang
On the Edge Systems Administration with Golang
 
DLL Design with Building Blocks
DLL Design with Building BlocksDLL Design with Building Blocks
DLL Design with Building Blocks
 
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbgPractical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
 
.NET Debugging Workshop
.NET Debugging Workshop.NET Debugging Workshop
.NET Debugging Workshop
 

Dernier

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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...Neo4j
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Dernier (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

25 things i’ve learned about c#

  • 2. » Desktops ˃ WinForm ˃ WPF ˃ Linux, Mac, Solaris » Servers ˃ Web Apps ˃ Services (web/native) » Embedded Systems ˃ Micro .NET (Netduino, FEZ Domino) ˃ Windows Phone ˃ Robots ˃ iPhone » Gaming Consoles ˃ Xbox 360 ˃ Wii, Playstation 3 (via Mono) 2 25 Things I've Learned about C# - Phil Denoncourt http://mono-project.com
  • 3. » C# compiles to bytecode ˃ So it must be slow » Bytecode gets compiled to native code upon first usage ˃ Takes advantage of features that machine’s processor » Matches C++ in Int math, trig, and I/O. ˃ Little slower in floating point » C# benefits from disposing of objects when idle ˃ rather than when object is no longer used. » http://www.osnews.com/story/5602&page=3 3 25 Things I've Learned about C# - Phil Denoncourt
  • 4. » Built into the framework since 3.0 ˃ Add reference to System.Speech » Recognition ˃ Command based ˃ Dictation » Synthesis » Requires SAPI ˃ Windows Vista and Later ˃ Office 2003 and Later » http://gotspeech.net 4 25 Things I've Learned about C# - Phil Denoncourt
  • 5. » It’s easy to write ˃ ThreadPool.QueueUserWorkItem ˃ PLINQ ˃ BackgroundWorker component » It’s hard to debug ˃ Add trace / logging to your code » Make sure your classes are “ThreadSafe” ˃ Lock keyword ˃ Interlocked class » http://www.bluebytesoftware.com/blog/ 5 25 Things I've Learned about C# - Phil Denoncourt
  • 6. » Added in 3.0. Implemented as a generic class ˃ Allows you to consider value types that are nullable » Add ? to end of type ˃ Int? ˃ DateTime? ˃ String is already a reference type, thus already nullable » Null Coalesce operator ˃ Substitutes a value if the object is null ˃ Really low in operator precedence. Often need parens. » http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx 6 25 Things I've Learned about C# - Phil Denoncourt
  • 7. » Exceptions hold a lot of information » Throwing them is computationally expensive ˃ Avoid using exceptions as logic flow » Stack trace line numbers are available if PDBs are present with the binaries » There is a difference between ˃ throw ˃ throw ex; » http://msdn.microsoft.com/en- us/library/5b2yeyab(v=VS.100).aspx 7 25 Things I've Learned about C# - Phil Denoncourt
  • 8. » checked ˃ By default, overflow checking is disabled in C# + Depending on compiler options ˃ Placing statements in checked block enables checking ˃ There is also an unchecked keyword ˃ http://msdn.microsoft.com/en-us/library/74b4xzyw(v=VS.100).aspx » volatile ˃ Keyword that indicates field could be updated by multiple threads + Disables compiler optimizations that assume single threaded access ˃ Places a “lock” statement around access to the field ˃ http://msdn.microsoft.com/en-us/library/x13ttww7(v=VS.100).aspx 8 25 Things I've Learned about C# - Phil Denoncourt
  • 9. » Allows you to add new methods to existing classes ˃ Even sealed classes » Can operate on public members ˃ But not private members » Good way to add “missing” functionality to class ˃ Good way to make something unmaintainable » Internally – implemented as a static method passing in the current instance. » http://extensionmethod.net/ 9 25 Things I've Learned about C# - Phil Denoncourt
  • 10. » Generic template that defers initialization until used » System.Lazy<T> » Object will be initialized when the value member is accessed, or ToString() is called. » http://weblogs.asp.net/gunnarpeipman/archive/2009/05/19/net-framework-4-0-using-system-lazy-lt-t-gt.aspx 10 25 Things I've Learned about C# - Phil Denoncourt
  • 11. » Lambda operator => » Anonymous function ˃ Contains code » Returns a delegate » Used extensively in Linq » http://msdn.microsoft.com/en- us/library/bb311046.aspx 11 25 Things I've Learned about C# - Phil Denoncourt
  • 12. » Eliminates a lot of repetitive coding » Implemented as extension methods in System.Linq.dll » Must reference the assembly, and add a using statement: ˃ using System.Linq; » Different providers allow access to different types of data by exposing IQueryable interface ˃ Linq to Objects ˃ Linq to SQL ˃ Linq to Entities ˃ Linq to Xml » http://msdn.microsoft.com/en-us/netframework/aa904594.aspx 12 25 Things I've Learned about C# - Phil Denoncourt
  • 13. » Normally static fields exist once per AppDomain » [ThreadStatic] static fields exist once per Thread » Static constructors and initializers still only execute once. ˃ So you have to make sure the object is not null before using it » http://blogs.msdn.com/b/jfoscoding/archive/2006/07/18/670497. aspx 13 25 Things I've Learned about C# - Phil Denoncourt
  • 14. » Allows you to move a class from one assembly to another without breaking callers » [assembly:TypeForwardedTo(typeof(classThatWasMoved)] ˃ Place this statement in the original assembly, which must reference the new assembly. » Used for refactoring types into different assemblies, and not have to rebuild the caller assembly. ˃ Namespace and name can’t change » Can also redirect entire assembly in .config file ˃ assemblyBinding section » http://msdn.microsoft.com/en-us/library/ms404275.aspx 14 25 Things I've Learned about C# - Phil Denoncourt
  • 15. » Don’t need to be based on int ˃ Can be byte, sbyte, short, ushort, int, uint, long, or ulong. » If you use the FlagsAttribute, you can perform bitwise operations ˃ Meaning that you can store more than one state in an enum variable. » http://dotnetperls.com/enum-flags 15 25 Things I've Learned about C# - Phil Denoncourt
  • 16. » -In addition to allowing shortcuts to namespaces » Automatically disposes objects when scope is outside of the using statement. » Object doesn’t need to be instantiated in the using statement ˃ But should » More than one object can be tracked by a using statement ˃ But they must be of the same type » http://msdn.microsoft.com/en-us/library/yh598w02.aspx 16 25 Things I've Learned about C# - Phil Denoncourt
  • 17. » Allows you to examine metadata about compiled code. » Has a reputation for being slow ˃ I haven’t found that to be very true » Allows access to private methods / fields of a class » You can also get the actual IL of the method for reverse engineering ˃ Which is what Reflector does » http://msdn.microsoft.com/en-us/library/f7ykdhsy(v=VS.100).aspx 17 25 Things I've Learned about C# - Phil Denoncourt
  • 18. » Can call other constructor methods ˃ Add :this to call a constructor in the current object ˃ Add :base to call a constructor in the base object » http://msdn.microsoft.com/en-us/library/ms173115.aspx 18 25 Things I've Learned about C# - Phil Denoncourt
  • 19. » Allows you to write code against an abstract type ˃ Type Parameter » When generic is used, a type is specified. ˃ Reduces the amount of boxing » Generics can be applied to ˃ Classes ˃ Delegates ˃ Methods ˃ Interfaces » Instead of comparing to null, compare to default(t) » http://msdn.microsoft.com/en- us/library/512aeb7t(v=VS.100).aspx 19 25 Things I've Learned about C# - Phil Denoncourt
  • 20. » Allows you to constrain what types can be used with a generic » Can constrain ˃ Classes that implement an interface ˃ Classes must have a common base class ˃ Parameterless constructor ˃ That the type is a class ˃ That the type is a struct » Constraints enforced by the compiler » http://msdn.microsoft.com/en-us/library/d5x73970.aspx 20 25 Things I've Learned about C# - Phil Denoncourt
  • 21. » Very easy since .NET 2.0 ˃ No more worrying about holding onto disposable objects » File class – static methods for ˃ Copying ˃ Renaming ˃ Deleting ˃ Checking existing ˃ Reading /writing data to a file ˃ Encrypt/Decrypt a file ˃ http://msdn.microsoft.com/en-us/library/system.io.file.aspx » Path class – static methods for ˃ Assembling a filename ˃ Changing extensions ˃ Getting a truly temporary filename ˃ http://msdn.microsoft.com/en-us/library/system.io.path.aspx 21 25 Things I've Learned about C# - Phil Denoncourt
  • 22. » Mostly done for you » .NET 4.0 supports 354 different cultures » Allows you to properly ˃ Format numbers ˃ Format currency ˃ Format date/times ˃ Compare strings » By default, the culture of the current thread is used when formatting/comparing » Globalization != Localization » http://en.wikibooks.org/wiki/.NET_Development_Foundation/Glo balization 22 25 Things I've Learned about C# - Phil Denoncourt
  • 23. » You can write code that writes code » Emits C# or VB.Net » Or can build an assembly using a compiler » Can build the assembly in memory ˃ Doesn’t get written to disk. » http://www.15seconds.com/issue/020917.htm 23 25 Things I've Learned about C# - Phil Denoncourt
  • 24. » GZipStream class only compresses one file » System.IO.Packaging ˃ Add reference to “WindowsBase” » Add each file as part of the package » It will add a [Content_Types].xml file to every zip file ˃ Part of the open packaging specification » http://madprops.org/blog/zip-your-streams-with-system-io- packaging/ 24 25 Things I've Learned about C# - Phil Denoncourt
  • 25. » Goto in switch statement » >> multiplies by powers of 2, << divides ˃ Real fast » as operator ˃ Faster than cast, doesn’t throw exception » @ string constant qualifier ˃ Ignores escapes » StringBuilder concatenates strings faster ˃ For only for large amounts of data 25 25 Things I've Learned about C# - Phil Denoncourt
  • 26. » Code Access Security » Strong names » Lackluster support for Xml Documentation » Lack of development in certain libraries ˃ Linq to SQL ˃ ASP.NET 26 25 Things I've Learned about C# - Phil Denoncourt