The document discusses delegates in C#. Key points:
- A delegate allows a method to be passed as a reference and invoked through that reference. It is similar to a function pointer in C/C++.
- A delegate is declared using the "delegate" keyword and specifies the return type and parameters of methods that can be passed to it.
- A delegate instance can refer to and call any method that matches the delegate's return type and parameters.
- Delegates allow methods to be passed and called, enabling events and callbacks. They also support multicasting of multiple methods to be invoked with a single call.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
We all have good and bad thoughts from time to time and situation to situation. We are bombarded daily with spiraling thoughts(both negative and positive) creating all-consuming feel , making us difficult to manage with associated suffering. Good thoughts are like our Mob Signal (Positive thought) amidst noise(negative thought) in the atmosphere. Negative thoughts like noise outweigh positive thoughts. These thoughts often create unwanted confusion, trouble, stress and frustration in our mind as well as chaos in our physical world. Negative thoughts are also known as “distorted thinking”.
How to Split Bills in the Odoo 17 POS ModuleCeline George
Bills have a main role in point of sale procedure. It will help to track sales, handling payments and giving receipts to customers. Bill splitting also has an important role in POS. For example, If some friends come together for dinner and if they want to divide the bill then it is possible by POS bill splitting. This slide will show how to split bills in odoo 17 POS.
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
2. Delegate
• A delegate provides a way to encapsulate
a method.
• An event is a notification that some
action has occurred.
• Delegates and events are related because
an event is built upon a delegate.
3. • A delegate is an object that can refer to
a method.
• when you create a delegate, you are
creating an object that can hold a
reference to a method.
• Furthermore, the method can be called
through this reference.
• A delegate can invoke the method to which
it refers.
• A delegate in C# is similar to a function
pointer in C/C++.
4. • A delegate type is declared using the
keyword delegate.
delegate return-type name (parameter-list );
• return-type is the type of value returned
by the methods that the delegate will be
calling.
• The name of the delegate is specified by
name.
• The parameters required by the methods
called through the delegate are specified
in the parameter-list.
5. • A delegate instance (Object) can refer
to and call methods whose return type
and parameter list match those
specified by the delegate declaration.
• The method can be either an instance
method associated with an object or a
static method associated with a class.
6. using System;
delegate string StrMod(string str);
class DelegateTest {
static string ReplaceSpaces(string s) {
Console.WriteLine("Replacing spaces with
hyphens.");
return s.Replace(' ', '-');
}
8. static string Reverse(string s) {
string temp = "";
int i, j;
Console.WriteLine("Reversing string.");
for(j=0, i=s.Length-1; i >= 0; i--, j++)
temp += s[i];
return temp;
}
9. static void Main() {
StrMod strOp = new
StrMod(ReplaceSpaces);
string str;
str = strOp("This is a test.");
Console.WriteLine("Resulting string: " + str);
Console.WriteLine();
strOp2 = new StrMod(RemoveSpaces);
str = strOp2("This is a test.");
Console.WriteLine("Resulting string: " + str);
10. strOp = new StrMod(Reverse);
str = strOp("This is a test.");
Console.WriteLine("Resulting string: " + str);
}
}
//output
Replacing spaces with hyphens.
Resulting string: This-is-a-test.
Removing spaces.
Resulting string: Thisisatest.
Reversing string.
Resulting string: .tset a si sihT
11.
12. Delegate Method Group
Conversion
• Since version 2.0, C# has included an
option that significantly simplifies the
syntax that assigns a method to a
delegate.
• This feature is called method group
conversion, and it allows you to simply
assign the name of a method to a
delegate, without using new or explicitly
invoking the delegate’s constructor.
13. // use method group conversion
StrMod strOp = ReplaceSpaces;
string str;
// Call methods through the delegate.
str = strOp("This is a test.");
Console.WriteLine("Resulting string: " +
str);
Console.WriteLine();
14.
15. Instance Methods as Delegates
delegate string StrMod(string str);
class StringOps {
public string ReplaceSpaces(string s) {
Console.WriteLine("Replacing spaces
with hyphens.");
return s.Replace(' ', '-');
}
16. public string RemoveSpaces(string s) {
string temp = "";
int i;
Console.WriteLine("Removing spaces.");
for(i=0; i < s.Length; i++)
if(s[i] != ' ') temp += s[i];
return temp;
}
17. public string Reverse(string s) {
string temp = "";
int i, j;
Console.WriteLine("Reversing string.");
for(j=0, i=s.Length-1; i >= 0; i--, j++)
temp += s[i];
return temp;
}
}
class DelegateTest {
static void Main() {
StringOps so = new StringOps();
18. // Initialize a delegate.
StrMod strOp = so.ReplaceSpaces;
string str;
// Call methods through delegates.
str = strOp("This is a test.");
Console.WriteLine("Resulting string: " +
str);
Console.WriteLine();
19. strOp = so.RemoveSpaces;
str = strOp("This is a test.");
Console.WriteLine("Resulting string: " +
str);
Console.WriteLine();
strOp = so.Reverse;
str = strOp("This is a test.");
Console.WriteLine("Resulting string: " +
str);
}}
20.
21. Multicasting
• One of the most exciting features of a
delegate is its support for multicasting.
• Multicasting is the ability to create an
invocation list, or chain, of methods
that will be automatically called when a
delegate is invoked.
• Such a chain is very easy to create.
22. • Simply instantiate a delegate, and then use
the + or += operator to add methods to the
chain.
• To remove a method, use – or – =.
• If the delegate returns a value, then the value
returned by the last method in the list
becomes the return value of the entire
delegate invocation.
• Thus, a delegate that makes use of
multicasting will often have a void return type.
23. using System;
// Declare a delegate type.
delegate void StrMod(ref string str);
class MultiCastDemo {
static void ReplaceSpaces(ref string s) {
Console.WriteLine("Replacing spaces with hyphens.");
s = s.Replace(' ', '-');
}
30. Covariance and Contravariance
• here are two features that add flexibility to
delegates: covariance and contravariance.
Normally, the method that you pass to a
delegate must have the same return type
and signature as the delegate.
• However, covariance and contravariance
relax this rule slightly, as it pertains to
derived types.
31. • Covariance enables a method to be
assigned to a delegate when the
method’s return type is a class derived
from the class specified by the return type
of the delegate.
• Contravariance enables a method to be
assigned to a delegate when a method’s
parameter type is a base class of the
class specified by the delegate’s
declaration.
32. covariance and contravariance
using System;
class X {
public int Val;
}
// Y is derived from X.
class Y : X { }
// This delegate returns X and takes a Y argument.
delegate X ChangeIt(Y obj);
33. class CoContraVariance {
static X IncrA(X obj) {
X temp = new X();
temp.Val = obj.Val + 1;
return temp;
}
static Y IncrB(Y obj) {
Y temp = new Y();
temp.Val = obj.Val + 1;
return temp;
}
35. • ChangeIt change = IncrA;
• uses contravariance to enable IncrA( ) to
be passed to the delegate because IncrA(
) has an X parameter, but the delegate
has a Y parameter. This works
because, with contravariance, if the
parameter type of the method passed to a
delegate is a base class of the parameter
type used by the delegate, then the
method and the delegate are compatible.
36. • The next line is also legal, but this time it
is because of covariance:
• change = IncrB;
• In this case, the return type of IncrB( )
is Y, but the return type of ChangeIt is
X. However, because the return type of
the method is a class derived from the
return type of the delegate, the two are
compatible.