Is there a sure fire way to discern whether the users logged in portal is enterprise or AGOL?
I thought about a string test against portalInfo.OrganizationId == "0123456789ABCDEF"
which I believe is always Enterprise - but could this value ever change and as a result break my test?
Or there is portalInfo.PortalName which returns "ArcGIS Enterprise" - but could this be changed too?
Anyway if there is someone who knows more than me, I'm all ears 
Simon.