示例#1
0
        public static string NullButNotEmpty(string value, string parameterName)
        {
            if (!ReferenceEquals(value, null) &&
                (value.Length == 0))
            {
                NotEmpty(parameterName, nameof(parameterName));

                throw new ArgumentException(ResX.ArgumentIsEmpty(parameterName));
            }

            return(value);
        }
示例#2
0
        public static string NotEmpty(string value, string parameterName)
        {
            Exception e = null;

            if (ReferenceEquals(value, null))
            {
                e = new ArgumentNullException(parameterName);
            }
            else if (value.Trim().Length == 0)
            {
                e = new ArgumentException(ResX.ArgumentIsEmpty(parameterName));
            }

            if (e != null)
            {
                NotEmpty(parameterName, nameof(parameterName));

                throw e;
            }

            return(value);
        }