// cgroup v2: Find the first entry that matches the cgroup v2 hierarchy:
// 0::$PATH
- if ((lineParts[0] == "0") && (lineParts[1] == string.Empty))
+ if ((lineParts[0] == "0") && (lineParts[1].Length == 0))
{
path = lineParts[2];
return true;
string currentCategoryName = _categoryName;
string currentMachineName = _machineName;
- if (currentCategoryName == string.Empty)
+ if (currentCategoryName.Length == 0)
throw new InvalidOperationException(SR.CategoryNameMissing);
- if (_counterName == string.Empty)
+ if (_counterName.Length == 0)
throw new InvalidOperationException(SR.CounterNameMissing);
if (ReadOnly)
iniWriter.Write(languageId);
iniWriter.Write(HelpSufix);
iniWriter.Write("=");
- if (categoryHelp == null || categoryHelp == string.Empty)
+ if (string.IsNullOrEmpty(categoryHelp))
iniWriter.WriteLine(SR.HelpNotAvailable);
else
iniWriter.WriteLine(categoryHelp);
environmentBlock = GetEnvironmentVariablesBlock(startInfo._environmentVariables!);
}
string workingDirectory = startInfo.WorkingDirectory;
- if (workingDirectory == string.Empty)
+ if (workingDirectory.Length == 0)
workingDirectory = Directory.GetCurrentDirectory();
bool retVal;
/// </summary>
public static string GetFileName(string originalPath)
{
- if (Suffix == string.Empty)
+ if (string.IsNullOrEmpty(Suffix))
return originalPath;
string newPath = AppendSuffix(originalPath);
if (path == null)
throw new ArgumentNullException(nameof(path));
- if (path == string.Empty)
+ if (path.Length == 0)
{
throw new ArgumentException(SR.Argument_EmptyPath, nameof(path));
}
if (path == null)
throw new ArgumentNullException(nameof(path));
- if (path == string.Empty)
+ if (path.Length == 0)
{
throw new ArgumentException(SR.Argument_EmptyPath, nameof(path));
}
if (path == null)
throw new ArgumentNullException(nameof(path));
- if (path == string.Empty)
+ if (path.Length == 0)
{
throw new ArgumentException(SR.Argument_EmptyPath, nameof(path));
}
if (destinationFileName == null)
throw new ArgumentNullException(nameof(destinationFileName));
- if (sourceFileName == string.Empty)
+ if (sourceFileName.Length == 0)
{
throw new ArgumentException(SR.Argument_EmptyPath, nameof(sourceFileName));
}
- if (destinationFileName == string.Empty)
+ if (destinationFileName.Length == 0)
{
throw new ArgumentException(SR.Argument_EmptyPath, nameof(destinationFileName));
}
if (destinationFileName == null)
throw new ArgumentNullException(nameof(destinationFileName));
- if (sourceFileName == string.Empty)
+ if (sourceFileName.Length == 0)
{
throw new ArgumentException(SR.Argument_EmptyPath, nameof(sourceFileName));
}
- if (destinationFileName == string.Empty)
+ if (destinationFileName.Length == 0)
{
throw new ArgumentException(SR.Argument_EmptyPath, nameof(destinationFileName));
}
if (destinationFileName == null)
throw new ArgumentNullException(nameof(destinationFileName));
- if (sourceFileName == string.Empty)
+ if (sourceFileName.Length == 0)
{
throw new ArgumentException(SR.Argument_EmptyPath, nameof(sourceFileName));
}
- if (destinationFileName == string.Empty)
+ if (destinationFileName.Length == 0)
{
throw new ArgumentException(SR.Argument_EmptyPath, nameof(destinationFileName));
}
if (destinationDirectoryName == null)
throw new ArgumentNullException(nameof(destinationDirectoryName));
- if (sourceDirectoryName == string.Empty)
+ if (sourceDirectoryName.Length == 0)
{
throw new ArgumentException(SR.Argument_EmptyPath, nameof(sourceDirectoryName));
}
- if (destinationDirectoryName == string.Empty)
+ if (destinationDirectoryName.Length == 0)
{
throw new ArgumentException(SR.Argument_EmptyPath, nameof(destinationDirectoryName));
}
internal static void ThrowIfInvalidRelationshipType(string relationshipType)
{
// Look for empty string or string with just spaces
- if (relationshipType.Trim() == string.Empty)
+ if (string.IsNullOrWhiteSpace(relationshipType))
throw new ArgumentException(SR.InvalidRelationshipType);
}
if (fragment != null)
{
- if (fragment == string.Empty || fragment[0] != '#')
+ if (fragment.Length == 0 || fragment[0] != '#')
throw new ArgumentException(SR.Format(SR.FragmentMustStartWithHash, nameof(fragment)));
}
string partName = GetStringForPartUriFromAnyUri(packUri);
- if (partName == string.Empty)
+ if (partName.Length == 0)
return null;
else
return ValidatePartUri(new Uri(partName, UriKind.Relative));
string partName = GetStringForPartUriFromAnyUri(resolvedUri);
- if (partName == string.Empty)
+ if (partName.Length == 0)
throw new ArgumentException(SR.PartUriIsEmpty);
ThrowIfPartNameEndsWithSlash(partName);
//We need to make sure that the URI passed to us is not just "/"
//"/" is a valid relative uri, but is not a valid partname
- if (partName == string.Empty)
+ if (partName.Length == 0)
return new ArgumentException(SR.PartUriIsEmpty);
if (partName[0] != ForwardSlashChar)
// String.Split, will always return an empty string as the
// first member in the array as the string starts with a "/"
- Debug.Assert(segments.Length > 0 && segments[0] == string.Empty);
+ Debug.Assert(segments.Length > 0 && segments[0].Length == 0);
//If the extension was not equal to .rels, we would have exited early.
Debug.Assert(string.CompareOrdinal((Path.GetExtension(segments[segments.Length - 1])), RelationshipPartUpperCaseExtension) == 0);
ThrowIfXmlAttributeMissing(attributeName, attributeValue, tagName, reader);
//Checking for empty attribute
- if (attributeValue == string.Empty)
+ if (attributeValue.Length == 0)
throw new XmlException(SR.Format(SR.RequiredAttributeEmpty, tagName, attributeName), null, ((IXmlLineInfo)reader).LineNumber, ((IXmlLineInfo)reader).LinePosition);
}
throw new ArgumentNullException(nameof(fileName));
}
- if (fileName == string.Empty)
+ if (fileName.Length == 0)
{
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(fileName)), nameof(fileName));
}
throw new ArgumentNullException(nameof(fileName));
}
- if (fileName == string.Empty)
+ if (fileName.Length == 0)
{
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(fileName)), nameof(fileName));
}
_part.Stream.Close();
}
- if (mediaType == null || mediaType == string.Empty)
+ if (string.IsNullOrEmpty(mediaType))
{
mediaType = MediaTypeNames.Text.Plain;
}
public Attachment(string fileName, ContentType contentType) :
base(fileName, contentType)
{
- if (contentType.Name == null || contentType.Name == string.Empty)
+ if (string.IsNullOrEmpty(contentType.Name))
{
Name = Path.GetFileName(fileName);
}
{
throw new ArgumentNullException(nameof(address));
}
- if (address == string.Empty)
+ if (address.Length == 0)
{
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(address)), nameof(address));
}
{
throw new ArgumentNullException(nameof(addresses));
}
- if (addresses == string.Empty)
+ if (addresses.Length == 0)
{
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(addresses)), nameof(addresses));
}
if (to == null)
throw new ArgumentNullException(nameof(to));
- if (from == string.Empty)
+ if (from.Length == 0)
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(from)), nameof(from));
- if (to == string.Empty)
+ if (to.Length == 0)
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(to)), nameof(to));
_message = new Message(from, to);
if (to == null)
throw new ArgumentNullException(nameof(to));
- if (from == string.Empty)
+ if (from.Length == 0)
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(from)), nameof(from));
- if (to == string.Empty)
+ if (to.Length == 0)
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(to)), nameof(to));
_from = new MailAddress(from);
throw new ArgumentNullException(nameof(value));
}
- if (value == string.Empty)
+ if (value.Length == 0)
{
throw new ArgumentException(SR.net_emptystringset, nameof(value));
}
{
throw new ArgumentNullException(nameof(value));
}
- if (value == string.Empty)
+ if (value.Length == 0)
{
throw new ArgumentException(SR.net_emptystringset, nameof(value));
}
{
throw new ArgumentNullException(nameof(contentType));
}
- if (contentType == string.Empty)
+ if (contentType.Length == 0)
{
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(contentType)), nameof(contentType));
}
get { return Parameters["boundary"]; }
set
{
- if (value == null || value == string.Empty)
+ if (string.IsNullOrEmpty(value))
{
Parameters.Remove("boundary");
}
get { return Parameters["charset"]; }
set
{
- if (value == null || value == string.Empty)
+ if (string.IsNullOrEmpty(value))
{
Parameters.Remove("charset");
}
throw new ArgumentNullException(nameof(value));
}
- if (value == string.Empty)
+ if (value.Length == 0)
{
throw new ArgumentException(SR.net_emptystringset, nameof(value));
}
throw new ArgumentNullException(nameof(name));
}
- if (name == string.Empty)
+ if (name.Length == 0)
{
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name));
}
throw new ArgumentNullException(nameof(name));
}
- if (name == string.Empty)
+ if (name.Length == 0)
{
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name));
}
throw new ArgumentNullException(nameof(name));
}
- if (name == string.Empty)
+ if (name.Length == 0)
{
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name));
}
throw new ArgumentNullException(nameof(value));
}
- if (name == string.Empty)
+ if (name.Length == 0)
{
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name));
}
- if (value == string.Empty)
+ if (value.Length == 0)
{
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(value)), nameof(value));
}
{
throw new ArgumentNullException(nameof(value));
}
- if (name == string.Empty)
+ if (name.Length == 0)
{
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name));
}
- if (value == string.Empty)
+ if (value.Length == 0)
{
throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(value)), nameof(value));
}
if (request.MethodInfo.Operation == FtpOperation.Rename)
{
- string baseDir = (requestDirectory == string.Empty)
+ string baseDir = (requestDirectory.Length == 0)
? string.Empty : requestDirectory + "/";
commandList.Add(new PipelineEntry(FormatFtpCommand("RNFR", baseDir + requestFilename), flags));
if (cultureName != null)
{
- if (cultureName == string.Empty)
+ if (cultureName.Length == 0)
cultureName = "neutral";
sb.Append(", Culture=");
sb.AppendQuoted(cultureName);
{
return JsonGlobals.xmlPrefix;
}
- if (ns == string.Empty)
+ if (ns.Length == 0)
{
return string.Empty;
}
{
return _nameTable.Add("xml");
}
- if (namespaceName == string.Empty)
+ if (namespaceName.Length == 0)
{
return string.Empty;
}
{
return schema;
}
- else if (tns == string.Empty)
+ else if (tns.Length == 0)
{ //There could be a chameleon for same ns
// It is OK to pass in the schema we have found so far, since it must have the schemaUri we're looking for
// (we found it that way above) and it must be the original chameleon schema (the one without target ns)
{
throw new ArgumentNullException(nameof(name));
}
- if (name == string.Empty)
+ if (name.Length == 0)
{
throw new ArgumentException(SR.Empty_string_invalid, nameof(name));
}
{
throw new ArgumentNullException(nameof(name));
}
- if (name == string.Empty)
+ if (name.Length == 0)
{
throw new ArgumentException(SR.Empty_string_invalid, nameof(name));
}
{
if (name == null)
throw new ArgumentNullException(nameof(name));
- if (name == string.Empty)
+ if (name.Length == 0)
throw new ArgumentException("name cannot be empty", nameof(name));
if (global_type_created != null)
throw new InvalidOperationException("global fields already created");
{
if (className == null)
throw new ArgumentNullException(nameof(className));
- if (className == string.Empty)
+ if (className.Length == 0)
throw new ArgumentException("Type name can't be empty");
return assembly.InternalGetType(this, className, throwOnError, ignoreCase);
}
if (typeName == null)
throw new ArgumentNullException(nameof(typeName));
- if (typeName == string.Empty)
+ if (typeName.Length == 0)
if (throwOnError)
throw new TypeLoadException("A null or zero length string does not represent a valid Type.");
else