Documentation Inadequacy: Example for Builder classes (i.e. ScanSettings & ScanSettings.Builder)

JohnHindJohnHind GBMember ✭✭

Can anyone point me to an example of how to uses classes like the BLE ScanSettings in C#? In Java one would write something like:

    ScanSettings x = new ScanSettingsBuilder()
        .setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
            .build();

The closest I can get in C# (after a tremendous amount of trial and error and pure guesswork) is:

    ScanSettings.Builder xb = new ScanSettings.Builder();
    xb.SetScanMode(Android.Bluetooth.LE.ScanMode.LowLatency);
    ScanSettings x = xb.Build();

Is this how it is intended to be done? Seems inelegant to say the least!

In general there is a WOEFUL lack of examples (or even human-generated text!) in the API documentation. I know there are some excellent larger scale examples, but that does not help when you stray outside the area they cover. I also know that the same is true of the Google documentation for the Android API. But Microsoft documentation is much better on the whole - is there any chance Xamarin will up its game on this front now it is part of Microsoft?

Sign In or Register to comment.