Sharepoint - Change masterpage from Seattle to Oslo using CSOM, Sharepoint online

Use the MasterUrl and CustomMasterUrl properties of Web:

using (var ctx = new ClientContext( url ))
{
    var web = ctx.Web;
    var masterPageUrl = String.Format( "{0}/_catalogs/masterpage/oslo.master", ctx.Web.ServerRelativeUrl );

    web.MasterUrl = masterPageUrl;
    web.CustomMasterUrl = masterPageUrl;
    web.Update();

    ctx.Load( web );
    ctx.ExecuteQuery();
}

Changing Master page is very easy in SharePoint Using CSOM, we can give the Master Page URL in the web masterpage property, for reference u can check this link : apply-master-page-using-csom