In C# 1.0 and later, delegates can be declared as shown in the following example.
-->
C# 2.0 provides a simpler way to write the previous declaration, as shown in the following example.
In C# 2.0 and later, it is also possible to use an anonymous method to declare and initialize a delegate, as shown in the following example.
In C# 3.0 and later, delegates can also be declared and instantiated by using a lambda expression, as shown in the following example.
For more information, see Lambda Expressions.
The following example illustrates declaring, instantiating, and using a delegate. The
BookDB class encapsulates a bookstore database that maintains a database of books. It exposes a method, ProcessPaperbackBooks , which finds all paperback books in the database and calls a delegate for each one. The delegate type that is used is named ProcessBookDelegate . The Test class uses this class to print the titles and average price of the paperback books.
The use of delegates promotes good separation of functionality between the bookstore database and the client code. The client code has no knowledge of how the books are stored or how the bookstore code finds paperback books. The bookstore code has no knowledge of what processing is performed on the paperback books after it finds them.
ExampleRobust Programming
See also
Create Add In Processbook History
Create Add In Processbook Microsoft
-->
SharePoint-hosted add-ins are one of the two major types of SharePoint Add-ins. For an overview of SharePoint Add-ins and the two different types, see SharePoint Add-ins. Here's a summary of SharePoint-hosted add-ins:
In this article, you'll complete the following steps:
Set up your dev environment
There are many ways to set up a development environment for SharePoint Add-ins. This section explains the simplest way.
Get the tools
For Visual Studio 2017, installing the Microsoft Office Developer Tools should be done through the Visual Studio 2017 Installer, which can be accessed from the New Project window.
Reference earlier versions of Visual Studio or other Visual Studio documentation.
Sign up for an Office 365 developer subscription
Note
You might already have access to an Office 365 developer subscription:
To get an Office 365 plan:
Open your developer site
In a browser, navigate to the SharePoint site collection you created when you setup your Office 365 developer subscription. (If you don't have a site, follow the instructions here). You should see a site that looks like the one in the following figure. The Apps / Add-ins in Testing list on the page confirms that the website was made with the SharePoint Developer Site template. If you see a regular team site instead, wait a few minutes and then restart your site.
Note
Make a note of the site's URL; it's used when you create SharePoint Add-in projects in Visual Studio.
Your developer site home page with the Apps / Add-ins in Testing list
Create the add-in project
Code your add-in
For your first SharePoint-hosted SharePoint Add-in, we'll include the classic SharePoint extension: a custom list and list instance.
Run the add-in and test the list
Next steps
To create your add-ins, walk through the following steps in this order:
Comments are closed.
|
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |