/// <summary>
        /// <para>
        /// Get a list of available <see cref="CredentialProfile"/> objects.
        /// </para>
        /// <para>
        /// If ProfilesLocation is non-null and non-empty include profiles in the shared credentials
        /// file at the disk path in the ProfilesLocation property.
        /// </para>
        /// <para>
        /// If ProfilesLocation is null or empty and the platform supports the .NET SDK credentials file
        /// include profiles from the SDK credentials file and from the shared credentials file in the default location.
        /// </para>
        ///<para>
        /// If ProfilesLocation is null or empty and the platform doesn't support the .NET SDK credentials file
        /// include profiles from the shared credentials file in the default location.
        /// </para>
        /// </summary>
        /// <returns>A list of <see cref="CredentialProfile"/> objects.</returns>
        public List <CredentialProfile> ListProfiles()
        {
            var profiles = new List <CredentialProfile>();

            if (string.IsNullOrEmpty(ProfilesLocation) && UserCrypto.IsUserCryptAvailable)
            {
                var netSdkFile = new NetSDKCredentialsFile();
                profiles.AddRange(netSdkFile.ListProfiles());
            }
            var sharedFile = new SharedCredentialsFile(ProfilesLocation);

            profiles.AddRange(sharedFile.ListProfiles());

            return(profiles);
        }
        /// <summary>
        /// <para>
        /// Try to get a <see cref="CredentialProfile"/>
        /// </para>
        /// <para>
        /// If ProfilesLocation is non-null and non-empty search the shared credentials
        /// file at the disk path in the ProfilesLocation property.
        /// </para>
        /// <para>
        /// If ProfilesLocation is null or empty and the platform supports the .NET SDK credentials file
        /// search the SDK credentials file.  If the profile is not found search the shared credentials file in the default location.
        /// </para>
        ///<para>
        /// If ProfilesLocation is null or empty and the platform doesn't support the .NET SDK credentials file
        /// search the shared credentials file in the default location.
        /// </para>
        /// </summary>
        /// <param name="profileName">The name of the profile to get.</param>
        /// <param name="profile">The profile, if found</param>
        /// <returns>True if the profile was found, false otherwise.</returns>
        public bool TryGetProfile(string profileName, out CredentialProfile profile)
        {
            if (string.IsNullOrEmpty(ProfilesLocation) && UserCrypto.IsUserCryptAvailable)
            {
                var netCredentialsFile = new NetSDKCredentialsFile();
                if (netCredentialsFile.TryGetProfile(profileName, out profile))
                {
                    return(true);
                }
            }

            var sharedCredentialsFile = new SharedCredentialsFile(ProfilesLocation);

            if (sharedCredentialsFile.TryGetProfile(profileName, out profile))
            {
                return(true);
            }

            profile = null;
            return(false);
        }