SlideShare a Scribd company logo
C# Tutorial
Part 13 : Pointer
www.siri-kt.blogspot.com
• C# allows using pointer variables in a function of
code block when it is marked by
the unsafe modifier. The unsafe code or the
unmanaged code is a code block that uses
a pointer variable.
• Pointers
• A pointer is a variable whose value is the address of
another variable i.e., the direct address of the
memory location. similar to any variable or constant,
you must declare a pointer before you can use it to
store any variable address.
• The general form of a pointer declaration is:
• We discussed that delegates are used to reference any methods that has
the same signature as that of the delegate. In other words, you can call a
method that can be referenced by a delegate using that delegate object.
• Anonymous methods provide a technique to pass a code block as a
delegate parameter. Anonymous methods are the methods without a
name, just the body.
• You need not specify the return type in an anonymous method; it is
inferred from the return statement inside the method body.
• Writing an Anonymous Method
• Anonymous methods are declared with the creation of the delegate
instance, with a delegate keyword. For example,
• delegate void NumberChanger(int n); ... NumberChanger nc = delegate(int
x) { Console.WriteLine("Anonymous Method: {0}", x); };The code
block Console.WriteLine("Anonymous Method: {0}", x); is the body of the
anonymous method.
• The delegate could be called both with anonymous methods as well as
named methods in the same way, i.e., by passing the method parameters
to the delegate object.
• For example,
• nc(10);
SIRIKT
Sharing Knowledge is Learning
For more visit our website
www.siri-kt.blogspot.com

More Related Content

PPTX
PPTX
C# lecture 2: Literals , Variables and Data Types in C#
PPTX
Type checking
PPT
7.data types in c#
PPTX
C# Value Data Types and Reference Data Types
PPTX
Lecture 2 variables
PPTX
Programming Fundamentals
C# lecture 2: Literals , Variables and Data Types in C#
Type checking
7.data types in c#
C# Value Data Types and Reference Data Types
Lecture 2 variables
Programming Fundamentals

What's hot (20)

PDF
Fundamentals of Computing and C Programming - Part 2
PPTX
Datatype introduction- JAVA
PPTX
Variables in C and C++ Language
PPTX
Variables and data types in C++
PPTX
Lec9
PPT
Framework Design Guidelines
PPTX
Java Datatypes
PPT
C#3.0 & Vb 9.0 Language Enhancments
PPTX
What are variables and keywords in c++
PPTX
C keywords and identifiers
PPTX
Introduction to c++
PDF
Doppl development iteration #2
PDF
Value Types
PPTX
Data Types, Variables, and Constants in C# Programming
PDF
Lecture02 java
PPT
Chapter1 c programming data types, variables and constants
PPT
constants, variables and datatypes in C
PPTX
Variables in C++, data types in c++
PDF
Cp presentation
PPTX
C language
Fundamentals of Computing and C Programming - Part 2
Datatype introduction- JAVA
Variables in C and C++ Language
Variables and data types in C++
Lec9
Framework Design Guidelines
Java Datatypes
C#3.0 & Vb 9.0 Language Enhancments
What are variables and keywords in c++
C keywords and identifiers
Introduction to c++
Doppl development iteration #2
Value Types
Data Types, Variables, and Constants in C# Programming
Lecture02 java
Chapter1 c programming data types, variables and constants
constants, variables and datatypes in C
Variables in C++, data types in c++
Cp presentation
C language
Ad

More from Sireesh K (20)

PPTX
Cn10
PPTX
chanakya neeti
PPTX
chanakya neeti
DOCX
What is mvc
PPTX
PPTX
31cs
PPTX
PPTX
PPTX
PPTX
PPTX
PPTX
PPTX
PPTX
PPTX
PPTX
PPTX
PPTX
PPTX
PPTX
Cn10
chanakya neeti
chanakya neeti
What is mvc
31cs
Ad

Recently uploaded (20)

PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
01-Introduction-to-Information-Management.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Basic Mud Logging Guide for educational purpose
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Pharma ospi slides which help in ospi learning
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
VCE English Exam - Section C Student Revision Booklet
01-Introduction-to-Information-Management.pdf
PPH.pptx obstetrics and gynecology in nursing
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Complications of Minimal Access Surgery at WLH
Microbial diseases, their pathogenesis and prophylaxis
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Basic Mud Logging Guide for educational purpose
Anesthesia in Laparoscopic Surgery in India
Pharma ospi slides which help in ospi learning
STATICS OF THE RIGID BODIES Hibbelers.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Final Presentation General Medicine 03-08-2024.pptx
Microbial disease of the cardiovascular and lymphatic systems
human mycosis Human fungal infections are called human mycosis..pptx

12pointerin c#

  • 1. C# Tutorial Part 13 : Pointer www.siri-kt.blogspot.com
  • 2. • C# allows using pointer variables in a function of code block when it is marked by the unsafe modifier. The unsafe code or the unmanaged code is a code block that uses a pointer variable. • Pointers • A pointer is a variable whose value is the address of another variable i.e., the direct address of the memory location. similar to any variable or constant, you must declare a pointer before you can use it to store any variable address. • The general form of a pointer declaration is:
  • 3. • We discussed that delegates are used to reference any methods that has the same signature as that of the delegate. In other words, you can call a method that can be referenced by a delegate using that delegate object. • Anonymous methods provide a technique to pass a code block as a delegate parameter. Anonymous methods are the methods without a name, just the body. • You need not specify the return type in an anonymous method; it is inferred from the return statement inside the method body. • Writing an Anonymous Method • Anonymous methods are declared with the creation of the delegate instance, with a delegate keyword. For example, • delegate void NumberChanger(int n); ... NumberChanger nc = delegate(int x) { Console.WriteLine("Anonymous Method: {0}", x); };The code block Console.WriteLine("Anonymous Method: {0}", x); is the body of the anonymous method. • The delegate could be called both with anonymous methods as well as named methods in the same way, i.e., by passing the method parameters to the delegate object. • For example, • nc(10);
  • 5. For more visit our website www.siri-kt.blogspot.com