Your SlideShare is downloading. ×
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

15 anonymous methods, partial types and nullable types

800

Published on

Published in: Technology, Health & Medicine
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
800
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Anonymous Methods,Partial Types and Nullable Types Programming in C# tnngo2@gmail.com
  • 2. Anonymous Methods
  • 3. Anonymous Methods an inline nameless block of code.
  • 4. Features accept parameters ref, out, generic type cannot include jump statements such as goto and break
  • 5. Benefits No separate named methods Reduced number of methods Better understanding
  • 6. Implementation Anonymous methods are not given any return type Anonymous methods are not prefixed with access modifiers https://gist.github.com/2586919
  • 7. Referencing multiple anonymous methods https://gist.github.com/2586945
  • 8. Passing parameters https://gist.github.com/2586982
  • 9. Partial Types
  • 10. Partial Types indicates that other parts of the class, struct or interface can be defined in different files or namespaces. All the parts will be formed to the final type at compile time.
  • 11. Partial type? working on large projects, multiple programmers work on one class. working with automatically generated source, code can be added to the class without modifying the source file.
  • 12. Implementation Each of the partial parts of the code must have the same access modifier if a part of code is declared as abstract and others are declared as public => the entire code is considered abstract. Same as sealed class. https://gist.github.com/2592542
  • 13. Implementation (cont.) Partial Class https://gist.github.com/2592720
  • 14. Question
  • 15. Question
  • 16. Nullable Types
  • 17. Nullable types? Before C# 2.0, only reference type could be null
  • 18. Nullable types Null values can be defined for the value types. instance of the System.Nullable<T> struct.
  • 19. Implementation Nullable types have two properties: HasValue Value can also use the == and != operators if (x != null) y = x; https://gist.github.com/2592834
  • 20. Implementation (cont.) Nullable types in Expression https://gist.github.com/2592857
  • 21. ?? Operator assign a nullable type to a non-nullable type. https://gist.github.com/2592875

×