Using C#/.Net
Controversial Topics & Common
Mistakes
Stack
Managed Heap
(soh, loh)
Heap
Memory
Struct or Class?
Unmanaged Heap
Where to locate an array?
How to change stack size?
Desired improvements
• Compact LOHeap
• GarbageCollector in background
• Just-In-Time compiling in background
All these fe...
IDisposable
NVI & IDisposable
How to create thread?
• Thread
• ThreadPool
• Task
• Delegate.BeginInvoke()
• async await
• System.Timer
• Etc…
class System.Threading.Thread
We use it only:
• If you need a task to have a particular priority.
• If you have a task tha...
Async methods
IAsyncResult - the legacy model.
This model is no longer recommended for new
development.
We should use asyn...
Async programming
Multithreading guidelines
• Don't use Thread.Abort() to terminate other
threads.
• Don't use
Thread.Suspend(), Thread.Resu...
Strong name
• Weakly and strongly named assembly
• “Assembly, Version=1.0.0.1, Culture=neutral,
PublicKeyToken=f1cb1c59fa0...
Exception handling
C# - new syntactic sugar
• Var
• Anonymous methods
• Extension methods
Using of Var
Anonymous Method
Delegates
Delegates and memory leak
.Net’s .module
• csc /t:module MyModule.cs
• csc /t:exe /addmodule:MyModule.netmodule
Main.cs
Using of MSSql
• Store procedures
• Triggers
• Functions
• Views
• Indexes
“Using C#/.NET – “Controversial Topics & Common Mistakes”
“Using C#/.NET – “Controversial Topics & Common Mistakes”
Upcoming SlideShare
Loading in...5
×

“Using C#/.NET – “Controversial Topics & Common Mistakes”

256

Published on

by Vladymyr Kramar

Published in: Software, Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
256
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
7
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

“Using C#/.NET – “Controversial Topics & Common Mistakes”

  1. 1. Using C#/.Net Controversial Topics & Common Mistakes
  2. 2. Stack Managed Heap (soh, loh) Heap
  3. 3. Memory
  4. 4. Struct or Class?
  5. 5. Unmanaged Heap
  6. 6. Where to locate an array?
  7. 7. How to change stack size?
  8. 8. Desired improvements • Compact LOHeap • GarbageCollector in background • Just-In-Time compiling in background All these features are part of .Net 4.5.0 - 4.5.2
  9. 9. IDisposable
  10. 10. NVI & IDisposable
  11. 11. How to create thread? • Thread • ThreadPool • Task • Delegate.BeginInvoke() • async await • System.Timer • Etc…
  12. 12. class System.Threading.Thread We use it only: • If you need a task to have a particular priority. • If you have a task that might run a long time. • If you need to place threads into a single- threaded apartment. [STAThread] • if you should use a dedicated thread to abort that thread, suspend it, or discover it by name.
  13. 13. Async methods IAsyncResult - the legacy model. This model is no longer recommended for new development. We should use async await method.
  14. 14. Async programming
  15. 15. Multithreading guidelines • Don't use Thread.Abort() to terminate other threads. • Don't use Thread.Suspend(), Thread.Resume(). • Don't use lock(this). • If you are not sure the Monitor.Exit() will be called, then use Mutex.
  16. 16. Strong name • Weakly and strongly named assembly • “Assembly, Version=1.0.0.1, Culture=neutral, PublicKeyToken=f1cb1c59fa003011“ • Tampering
  17. 17. Exception handling
  18. 18. C# - new syntactic sugar • Var • Anonymous methods • Extension methods
  19. 19. Using of Var
  20. 20. Anonymous Method
  21. 21. Delegates
  22. 22. Delegates and memory leak
  23. 23. .Net’s .module • csc /t:module MyModule.cs • csc /t:exe /addmodule:MyModule.netmodule Main.cs
  24. 24. Using of MSSql • Store procedures • Triggers • Functions • Views • Indexes
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×