SlideShare a Scribd company logo
Getting Dirty – Part 2
Jamshid Hashimi, CodeWeekend
Agenda
• Structs
• Interfaces
• Introduction to Delegates and Events
• Introduction to Exception Handling
• Static Properties & Methods
• Using Attributes
• Enums
• Overloading Operators
• Introduction to Generic
Structs
• Struct is a value type
• Classes are reference types
• Structs can’t have destructors, classes do.
• The power of objects lies in their ability to mimic real-world behavior,
through inheritance and polymorphism.
• Supports interface inheritance
• Structs are best used for storing data, but the lack of inheritance and
references can be a serious limitation.
Interfaces
• An interface looks like a class, but has no implementation.
• It contains declarations of:
• Events, methods, properties..
• Inherited by classes and structs
• Interfaces can inherit other interfaces
Delegates and Events
• Delegates are just function pointers, That is, they hold references to
functions.
• Delegation is when you request a service by making a method call to
service provider.
• The service provider then reroutes this service request to another
method, which services the request.
• The delegate class can examine the service request and dynamically
determines at runtime where to route the request.
• Example: A manager receives a service request, she often delegates it
to a member of her department.
Delegates and Events
• Events are variables of type delegates.
• Events are user actions such as key press, clicks, mouse movements,
etc., or some occurrence such as system generated notifcations.
• Applications built with the .NET Framework are object-oriented,
event-driven programs.
• In Windows Applications, the user interacting with a GUI usually
initiates the event.
• A security class could broadcast an event message when an invalid
login is detected.
• You can subscribe to external events.
Introduction to Exception Handling
• Exceptions are unforeseen errors happen in your programs.
• There are times where you don’t know if an error will happen
• I/O error
• Run out of system memory
• Database and more
• You want to deal with them and this where Exception Handling comes
in.
Static Properties & Methods
• When you declare an object instance of a class, the object
instantiates its own instances of the properties and methods of the
class it implements.
• However, sometimes you may want different object instances of a
class to access the same, shared variables.
Attributes
• Attributes are elements that allow you to add declarative information
to your programs.
Enums
• If you have a number of constants that are logically related to each
other, then you can group together these constants in an
enumeration.
• Enums are strongly typed constants which makes the code more
readable and less prone to errors.
• You can specify another integral numeric type by using a colon.
• Enum allows us to create a new data type.
Overloading Operators
• You can redefine or overload most of the built-in operators available
in C#.
• Operator overloading provides a much natural abstraction for the
types.
• Overloaded operators are functions with special names the
keyword operator followed by the symbol for the operator being
defined.
Generics
• Generics allow you to delay the specification of the data type of
programming elements in a class or a method, until it is actually used
in the program
• Generics allow you to write a class or method that can work with any
data type.
• Features
• It helps you to maximize code reuse, type safety, and performance.
• You can create your own generic interfaces, classes, methods, events, and
delegates.
• And more..
Source Codes:
http://www.facebook.com/groups/CodeWeekend
Thank You!

More Related Content

What's hot (20)

PPTX
Classes objects in java
Madishetty Prathibha
 
PDF
Java data types, variables and jvm
Madishetty Prathibha
 
PPTX
Type checking
rawan_z
 
PDF
Lecture02 java
jawidAhmadRohani
 
PPTX
Abstract class and Interface
Haris Bin Zahid
 
PPTX
#_ varible function
abdullah al mahamud rosi
 
PDF
Basic IO
Ravi_Kant_Sahu
 
PPTX
Java 8 Functional Programming - I
Ugur Yeter
 
PPT
Framework Design Guidelines
Mohamed Meligy
 
PDF
Java essentials for hadoop
Seo Gyansha
 
PDF
L2 datatypes and variables
Ravi_Kant_Sahu
 
PPTX
Code quality
Hussain Mansoor
 
PPTX
Java platform
Visithan
 
PDF
Datatype
baran19901990
 
PPT
Introduction to objects and inputoutput
Ahmad Idrees
 
PPTX
Abstract Class In Java | Java Abstract Class Tutorial | Java Tutorial For Beg...
Simplilearn
 
PPTX
Abstraction in java [abstract classes and Interfaces
Ahmed Nobi
 
PPTX
SAP ABAP using OOPS - JH Softech
Vikram P Madduri
 
PPTX
Abstract class and interface
Mazharul Sabbir
 
Classes objects in java
Madishetty Prathibha
 
Java data types, variables and jvm
Madishetty Prathibha
 
Type checking
rawan_z
 
Lecture02 java
jawidAhmadRohani
 
Abstract class and Interface
Haris Bin Zahid
 
#_ varible function
abdullah al mahamud rosi
 
Basic IO
Ravi_Kant_Sahu
 
Java 8 Functional Programming - I
Ugur Yeter
 
Framework Design Guidelines
Mohamed Meligy
 
Java essentials for hadoop
Seo Gyansha
 
L2 datatypes and variables
Ravi_Kant_Sahu
 
Code quality
Hussain Mansoor
 
Java platform
Visithan
 
Datatype
baran19901990
 
Introduction to objects and inputoutput
Ahmad Idrees
 
Abstract Class In Java | Java Abstract Class Tutorial | Java Tutorial For Beg...
Simplilearn
 
Abstraction in java [abstract classes and Interfaces
Ahmed Nobi
 
SAP ABAP using OOPS - JH Softech
Vikram P Madduri
 
Abstract class and interface
Mazharul Sabbir
 

Similar to Week 2: Getting Your Hands Dirty – Part 2 (20)

PPTX
CPP19 - Revision
Michael Heron
 
PPTX
IET307 OOP - object oriented programming concepts.pptx
BasithAb2
 
PPTX
10-System-ModelingFL22-sketch-19122022-091234am.pptx
huzaifaahmed79
 
PPTX
PresentationPatterns_v2
Maksym Tolstik
 
PPTX
Object oriented programming
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
babasahebgaikwad8
 
PPTX
Iterator - a powerful but underappreciated design pattern
Nitin Bhide
 
PPTX
Diksha sda presentation
dikshagupta111
 
PPTX
unit-1 &2 important questions to be noted
22eg105n11
 
PPTX
Advanced Topics on Database - Unit-2 AU17
LOGANATHANK24
 
PPT
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane1
 
PPT
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane2
 
PPT
introduction-to-dbms-unit-1.ppt
rekhasai2468
 
PPTX
Patterns
Amith Tiwari
 
PDF
Software design with Domain-driven design
Allan Mangune
 
PPTX
Akka.Net Overview
Geoffrey Vandiest
 
PDF
Patterns of Distributed Application Design
GlobalLogic Ukraine
 
PPTX
Adbms 1 object oriented modeling
Vaibhav Khanna
 
PPTX
Distributed Computing - System Models.pptx
nirmalanr2
 
DOC
IBM OOAD Part1 Summary
Haitham Raik
 
CPP19 - Revision
Michael Heron
 
IET307 OOP - object oriented programming concepts.pptx
BasithAb2
 
10-System-ModelingFL22-sketch-19122022-091234am.pptx
huzaifaahmed79
 
PresentationPatterns_v2
Maksym Tolstik
 
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
babasahebgaikwad8
 
Iterator - a powerful but underappreciated design pattern
Nitin Bhide
 
Diksha sda presentation
dikshagupta111
 
unit-1 &2 important questions to be noted
22eg105n11
 
Advanced Topics on Database - Unit-2 AU17
LOGANATHANK24
 
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane1
 
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane2
 
introduction-to-dbms-unit-1.ppt
rekhasai2468
 
Patterns
Amith Tiwari
 
Software design with Domain-driven design
Allan Mangune
 
Akka.Net Overview
Geoffrey Vandiest
 
Patterns of Distributed Application Design
GlobalLogic Ukraine
 
Adbms 1 object oriented modeling
Vaibhav Khanna
 
Distributed Computing - System Models.pptx
nirmalanr2
 
IBM OOAD Part1 Summary
Haitham Raik
 
Ad

More from Jamshid Hashimi (20)

PPTX
Introduction to C# - Week 0
Jamshid Hashimi
 
PPTX
RIST - Research Institute for Science and Technology
Jamshid Hashimi
 
PPTX
How Coding Can Make Your Life Better
Jamshid Hashimi
 
PPTX
Mobile Vision
Jamshid Hashimi
 
PPTX
Tips for Writing Better Code
Jamshid Hashimi
 
PPTX
Launch Your Local Blog & Social Media Integration
Jamshid Hashimi
 
PPTX
Customizing Your Blog 2
Jamshid Hashimi
 
PPTX
Customizing Your Blog 1
Jamshid Hashimi
 
PPTX
Introduction to Blogging
Jamshid Hashimi
 
PPTX
Introduction to Wordpress
Jamshid Hashimi
 
PPTX
CodeIgniter Helper Functions
Jamshid Hashimi
 
PPTX
CodeIgniter Class Reference
Jamshid Hashimi
 
PPTX
Managing Applications in CodeIgniter
Jamshid Hashimi
 
PPTX
CodeIgniter Practice
Jamshid Hashimi
 
PPTX
CodeIgniter & MVC
Jamshid Hashimi
 
PPTX
PHP Frameworks & Introduction to CodeIgniter
Jamshid Hashimi
 
PPTX
Exception & Database
Jamshid Hashimi
 
PPTX
MySQL Record Operations
Jamshid Hashimi
 
PPTX
MySQL JOIN & UNION
Jamshid Hashimi
 
PPTX
MySQL basics
Jamshid Hashimi
 
Introduction to C# - Week 0
Jamshid Hashimi
 
RIST - Research Institute for Science and Technology
Jamshid Hashimi
 
How Coding Can Make Your Life Better
Jamshid Hashimi
 
Mobile Vision
Jamshid Hashimi
 
Tips for Writing Better Code
Jamshid Hashimi
 
Launch Your Local Blog & Social Media Integration
Jamshid Hashimi
 
Customizing Your Blog 2
Jamshid Hashimi
 
Customizing Your Blog 1
Jamshid Hashimi
 
Introduction to Blogging
Jamshid Hashimi
 
Introduction to Wordpress
Jamshid Hashimi
 
CodeIgniter Helper Functions
Jamshid Hashimi
 
CodeIgniter Class Reference
Jamshid Hashimi
 
Managing Applications in CodeIgniter
Jamshid Hashimi
 
CodeIgniter Practice
Jamshid Hashimi
 
CodeIgniter & MVC
Jamshid Hashimi
 
PHP Frameworks & Introduction to CodeIgniter
Jamshid Hashimi
 
Exception & Database
Jamshid Hashimi
 
MySQL Record Operations
Jamshid Hashimi
 
MySQL JOIN & UNION
Jamshid Hashimi
 
MySQL basics
Jamshid Hashimi
 
Ad

Recently uploaded (20)

PPTX
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
PDF
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
PDF
Why Are More Businesses Choosing Partners Over Freelancers for Salesforce.pdf
Cymetrix Software
 
PPTX
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PDF
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
PPT
Activate_Methodology_Summary presentatio
annapureddyn
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 
PDF
Salesforce Pricing Update 2025: Impact, Strategy & Smart Cost Optimization wi...
GetOnCRM Solutions
 
PPTX
Farrell__10e_ch04_PowerPoint.pptx Programming Logic and Design slides
bashnahara11
 
PDF
New Download FL Studio Crack Full Version [Latest 2025]
imang66g
 
PDF
Troubleshooting Virtual Threads in Java!
Tier1 app
 
PDF
Infrastructure planning and resilience - Keith Hastings.pptx.pdf
Safe Software
 
PDF
Supabase Meetup: Build in a weekend, scale to millions
Carlo Gilmar Padilla Santana
 
PDF
MiniTool Power Data Recovery Crack New Pre Activated Version Latest 2025
imang66g
 
PDF
Enhancing Security in VAST: Towards Static Vulnerability Scanning
ESUG
 
PDF
Virtual Threads in Java: A New Dimension of Scalability and Performance
Tier1 app
 
PDF
Applitools Platform Pulse: What's New and What's Coming - July 2025
Applitools
 
PDF
Download iTop VPN Free 6.1.0.5882 Crack Full Activated Pre Latest 2025
imang66g
 
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
Why Are More Businesses Choosing Partners Over Freelancers for Salesforce.pdf
Cymetrix Software
 
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
Activate_Methodology_Summary presentatio
annapureddyn
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 
Salesforce Pricing Update 2025: Impact, Strategy & Smart Cost Optimization wi...
GetOnCRM Solutions
 
Farrell__10e_ch04_PowerPoint.pptx Programming Logic and Design slides
bashnahara11
 
New Download FL Studio Crack Full Version [Latest 2025]
imang66g
 
Troubleshooting Virtual Threads in Java!
Tier1 app
 
Infrastructure planning and resilience - Keith Hastings.pptx.pdf
Safe Software
 
Supabase Meetup: Build in a weekend, scale to millions
Carlo Gilmar Padilla Santana
 
MiniTool Power Data Recovery Crack New Pre Activated Version Latest 2025
imang66g
 
Enhancing Security in VAST: Towards Static Vulnerability Scanning
ESUG
 
Virtual Threads in Java: A New Dimension of Scalability and Performance
Tier1 app
 
Applitools Platform Pulse: What's New and What's Coming - July 2025
Applitools
 
Download iTop VPN Free 6.1.0.5882 Crack Full Activated Pre Latest 2025
imang66g
 

Week 2: Getting Your Hands Dirty – Part 2

  • 1. Getting Dirty – Part 2 Jamshid Hashimi, CodeWeekend
  • 2. Agenda • Structs • Interfaces • Introduction to Delegates and Events • Introduction to Exception Handling • Static Properties & Methods • Using Attributes • Enums • Overloading Operators • Introduction to Generic
  • 3. Structs • Struct is a value type • Classes are reference types • Structs can’t have destructors, classes do. • The power of objects lies in their ability to mimic real-world behavior, through inheritance and polymorphism. • Supports interface inheritance • Structs are best used for storing data, but the lack of inheritance and references can be a serious limitation.
  • 4. Interfaces • An interface looks like a class, but has no implementation. • It contains declarations of: • Events, methods, properties.. • Inherited by classes and structs • Interfaces can inherit other interfaces
  • 5. Delegates and Events • Delegates are just function pointers, That is, they hold references to functions. • Delegation is when you request a service by making a method call to service provider. • The service provider then reroutes this service request to another method, which services the request. • The delegate class can examine the service request and dynamically determines at runtime where to route the request. • Example: A manager receives a service request, she often delegates it to a member of her department.
  • 6. Delegates and Events • Events are variables of type delegates. • Events are user actions such as key press, clicks, mouse movements, etc., or some occurrence such as system generated notifcations. • Applications built with the .NET Framework are object-oriented, event-driven programs. • In Windows Applications, the user interacting with a GUI usually initiates the event. • A security class could broadcast an event message when an invalid login is detected. • You can subscribe to external events.
  • 7. Introduction to Exception Handling • Exceptions are unforeseen errors happen in your programs. • There are times where you don’t know if an error will happen • I/O error • Run out of system memory • Database and more • You want to deal with them and this where Exception Handling comes in.
  • 8. Static Properties & Methods • When you declare an object instance of a class, the object instantiates its own instances of the properties and methods of the class it implements. • However, sometimes you may want different object instances of a class to access the same, shared variables.
  • 9. Attributes • Attributes are elements that allow you to add declarative information to your programs.
  • 10. Enums • If you have a number of constants that are logically related to each other, then you can group together these constants in an enumeration. • Enums are strongly typed constants which makes the code more readable and less prone to errors. • You can specify another integral numeric type by using a colon. • Enum allows us to create a new data type.
  • 11. Overloading Operators • You can redefine or overload most of the built-in operators available in C#. • Operator overloading provides a much natural abstraction for the types. • Overloaded operators are functions with special names the keyword operator followed by the symbol for the operator being defined.
  • 12. Generics • Generics allow you to delay the specification of the data type of programming elements in a class or a method, until it is actually used in the program • Generics allow you to write a class or method that can work with any data type. • Features • It helps you to maximize code reuse, type safety, and performance. • You can create your own generic interfaces, classes, methods, events, and delegates. • And more..

Editor's Notes

  • #6: Useful link: http://www.codeproject.com/Articles/4773/Events-and-Delegates-Simplified