How to call an extension – Yahoo ist jetzt Teil von Oath

How to: Call an Extension Method (Visual Basic)

  • 2 minutes to read

  • Contributors

In this article

Extension methods enable you to add methods to an existing class. After an extension method is declared and brought into scope, you can call it like an instance method of the type that it extends. For more information about how to write an extension method, see How to: Write an Extension Method.

The following instructions refer to extension method PrintAndPunctuate, which will display the string instance that invokes it, followed by whatever value is sent in for the second parameter, punc.

Imports System.Runtime.CompilerServices  
Module StringExtensions  
    Public Sub PrintAndPunctuate(ByVal aString As String,   
                                 ByVal punc As String)  
        Console.WriteLine(aString & punc)  
    End Sub  
End Module  

The method must be in scope when it is called.

To call an extension method

  1. Declare a variable that has the data type of the first parameter of the extension method. For PrintAndPunctuate, you need a String variable:

    Dim example = "Ready"  
  2. That variable will invoke the extension method, and its value is bound to the first parameter, aString. The following calling statement will display Ready?.


    Notice that the call to this extension method looks just like a call to any one of the String instance methods that require one parameter:

  3. Declare another string variable and call the method again to see that it works with any string.

    Dim example2 = " or not"  

    The result this time is: or not!!!.


The following code is a complete example of the creation and use of a simple extension method.

Imports System.Runtime.CompilerServices  
Imports ConsoleApplication1.StringExtensions  
Module Module1  
    Sub Main()  
        Dim example = "Hello"  
        Dim example2 = "Goodbye"  
    End Sub  
    Public Sub PrintAndPunctuate(ByVal aString As String,   
                                 ByVal punc As String)  
        Console.WriteLine(aString & punc)  
    End Sub  
End Module  
' Output:  
' Hello.  
' Hello!!!!  
' Goodbye?  

See Also

How to: Write an Extension Method
Extension Methods
Scope in Visual Basic

How to Dial An Extension on iPhone (Plus, Save Extensions to Contacts!)

If you dial an extension, you can avoid automated operators. Or if you consistently call into conference calls with extensions, we’ll also go over how to save phone numbers with extensions to your Contacts. If need to call a company and you have the extension for the person you’re trying to reach, use this article to automatically dial the extension on your iPhone, without needing to hear any automated prompts. Dialing an extension on iPhone is also super easy; so once you’ve learned how to call the extension, it’ll be no problem to remember in the future. Here’s how to dial an extension on your iPhone.

Related: How To Redial a Phone Number on Your iPhone

If you rarely dial extensions on your iPhone, the first tip will simply show you how to make the call. But if you’ll be regularly calling the extension, follow the second part to learn how to save a number with an extension to your Contacts. Overall, this whole process is easy and automatic. To dial the extension, you’ll just need a pause.

How to Dial an Extension on iPhone

  • Open the Phone app.
  • Dial the main number you’re calling.
  • Then hold down the * (asterisk) until a comma appears.
  • Now enter the extension number after the comma.

  • Tap the green Call button and you’ll dial straight to the person you’re trying to reach.

When you do this, make sure you hold down the * long enough to turn it into a comma. The comma acts as a pause and lets your phone know it’s dialing an extension.

How to Save Extensions in Your iPhone Contacts

If you plan to regularly call an extension, you can save it in your Contacts. That way, the next time you go to dial the extension, it will already be saved as it needs to be dialed. Here’s how to save a number with the extension to your Contacts on iPhone:

  • Open your Phone app and select Contacts or open your Contacts app on iPhone.
  • For our how-to, we’re assuming you already have the number saved. If not, simply create a new contact by tapping the plus sign in the upper right corner of your Contacts app.
  • Find the contact number that you want to add an extension to and tap on it.
  • Tap Edit in the upper right corner.

  • Tap the number you’re adding the extension to, or tap the plus sign next to add phone to add a new phone number to the contact.
  • You’ll notice the keyboard at the bottom of your screen is all numbers with a special characters tab in the lower left corner, tap the special characters.

  • With the cursor at the end of the phone number, tap Pause to insert a comma.
  • Now enter the extension.


Top Image Credit: 10 FACE /

What is a Call Extension?

What is a Call Extension?

A call extension is an ad extension in Google Ads (formerly AdWords) that will show your phone number alongside your ad. On mobile this can show up as a “click-to-call” button.

How Does a Call Extension Work?

One of many “ad extensions” you can run within Google Ads, call extensions append your phone number to your ad on the SERP. You can add these phone numbers at an account level, campaign level, or ad group level depending on what works best per the size and structure of your account.

These call extensions won’t always show up though. Google chooses to show extensions it believes will most likely improve the performance of the ad. Additionally, Google has a minimum Ad Rank that your ads must meet in order to show and your ad has to be showing high enough on the SERP. Google only has a limited amount of page real estate above the organic listings to show ads, so only the top position ads (typically 1 and 2), are able to show extensions.

Who Uses Call Extensions?

Any advertiser looking to receive calls to their business should be using call extensions. This ensures that in addition to seeing compelling ad copy and your website URL, prospects who’ve searched for your brand or product see your business phone number, and if they’re so inclined can call it.

How to Set Up a Call Extension:

To set up a call extension you’ll need to navigate to the “Ad Extensions” tab and select “Call Extensions” from the “View” drop down.

Once that’s selected you’ll have the option of adding an extension at either the account, campaign or ad group level.

Whether you set up your call extension on the account, campaign or ad group level is dependent on several factors:

  • The size of your account
  • The structure of your account
  • How you want to segment your call data

If you’re a small business offering one or two products setting up call extensions on the account level is likely a good fit. This means that the same call extension will run with every ad in your account. This also makes sense for any business that is only using one phone number.

If your account is relatively large, with multiple campaigns broken down by brand keywords, product types, etc. and you have multiple tracking phone numbers, adding your call extensions on the campaign level is likely your best move.

Adding your call extension at an ad group level adds one more level of specificity if you have dramatically different ad groups living within one campaign. If that is the case you can certainly add your call extensions here, but in a lot of instances the better choice would likely be to reorganize your campaigns so that one number works for each campaign.

Once you’ve selected where you want your call extension to go, it’s time to actually create it. You’ll hit the “+Extension” button and then the “+New Phone Number” button to bring up the setup screen.

Here you can input the number you’d like called, whether you want call reporting turned on using a google forwarding number, if you’d prefer this number to show on mobile devices, and when you’d like the ad to show.

If you want to enable call reporting, which will create a conversion in your account for each phone call made, click “On” for “Call Reporting” and select “Count calls as phone call conversions.” You’ll also have to create a conversion action to associate with these calls.

You have the option to schedule the times when your call extensions show. If you’re only manning the phones at your business during certain hours, scheduling here is an easy way to make sure your number is only listed while you’re able to take calls.

Once you’re finished here you’ll click save and you’re done!

Call extensions and call reporting are an important part of generating results via Google Ads as well as reporting on those results to clients. When you’re running call extensions in Ads there is some insight you can get from these calls in the “Dimensions” tab, but to really delve into these calls and gain actionable insights, it’s helpful to work with a call tracking vendor so you can generate multiple numbers, listen to call recordings and evaluate the quality of calls as leads.

To learn more about how call tracking and analytics can improve your business, request your no-obligation demo of CallRail, or go ahead and start your 14-day free trial.

Отправить ответ

Уведомление о