4
namespace ClientApp
{
    [Service(Exported = false)]
    class RegistrationIntentService : IntentService
    {
        static object locker = new object();

        public RegistrationIntentService() :  base("RegistrationIntentService") { }

In the snippet above, the constructor extends a base("RegistrationIntentService"), what is this doing? I found this example at: https://developer.xamarin.com/guides/cross-platform/application_fundamentals/notifications/android/remote_notifications_in_android/

Does it mean the contructor is the same as the RegistrationIntentService constructor?

Shawn Mehan
  • 4,513
  • 9
  • 31
  • 51
IcyBright
  • 654
  • 4
  • 15
  • 3
    This isn't Xamarin-specific - it's just C# syntax for calling the base class constructor. If you're new to C#, I'd strongly learn the basics of the language in a more conventional environment before you move on to mobile where there are extra constraints and oddities. – Jon Skeet Oct 30 '15 at 17:50

1 Answers1

3

This is just calling IntentService's constructor with a string parameter "RegistrationIntentService". It is a C# language keyword and is not Xamarin specific.

If the base class of an object does not have a default constructor, you must provide parameters to a base constructor in the derived class's constructor using this syntax.

See the MSDN documentation on the base keyword for some examples.

E. Moffat
  • 3,165
  • 1
  • 21
  • 34