Dev2.Converters.Dev2Base64Converter.IsType C# (CSharp) Method

IsType() public method

public IsType ( string payload ) : bool
payload string
return bool
        public bool IsType(string payload)
        {
            bool result = false;
            try
            {
                // ReSharper disable ReturnValueOfPureMethodIsNotUsed
                Convert.FromBase64String(payload);
                // ReSharper restore ReturnValueOfPureMethodIsNotUsed
                result = true;
            }
                // ReSharper disable EmptyGeneralCatchClause
            catch
                // ReSharper restore EmptyGeneralCatchClause
            {
                // if error is thrown we know it is not a valid base64 string
            }

            return result;
        }