1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-12 02:30:29 +09:00

Enable IDE0100 (Remove redundant equality) (#70896)

This commit is contained in:
Stephen Toub 2022-06-19 00:43:37 -04:00 committed by GitHub
parent 656f909fb0
commit 8442a62336
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
90 changed files with 283 additions and 301 deletions

View file

@ -1546,7 +1546,7 @@ dotnet_diagnostic.IDE0084.severity = none
dotnet_diagnostic.IDE0090.severity = silent
# IDE0100: Remove redundant equality
dotnet_diagnostic.IDE0100.severity = suggestion
dotnet_diagnostic.IDE0100.severity = warning
# IDE0110: Remove unnecessary discard
dotnet_diagnostic.IDE0110.severity = warning

View file

@ -479,7 +479,7 @@ namespace Internal.Runtime.TypeLoader
for (uint i = 0; i < data; i++)
result = TypeSignatureHasVarsNeedingCallingConventionConverter(ref parser, moduleHandle, context, HasVarsInvestigationLevel.NotParameter) || result;
if ((result == true) && (investigationLevel == HasVarsInvestigationLevel.Parameter))
if (result && (investigationLevel == HasVarsInvestigationLevel.Parameter))
{
if (!TryComputeHasInstantiationDeterminedSize(genericTypeDef, context, out result))
Environment.FailFast("Unable to setup calling convention converter correctly");

View file

@ -74,7 +74,7 @@ namespace System.Data.ProviderBase
foreach (DataRow row in sourceTable.Rows)
{
if (SupportedByCurrentVersion(row) == true)
if (SupportedByCurrentVersion(row))
{
newRow = destinationTable.NewRow();
for (int i = 0; i < destinationColumns.Count; i++)
@ -195,7 +195,7 @@ namespace System.Data.ProviderBase
int columnCount = 0;
foreach (DataColumn sourceColumn in sourceTable.Columns)
{
if (IncludeThisColumn(sourceColumn, hiddenColumnNames) == true)
if (IncludeThisColumn(sourceColumn, hiddenColumnNames))
{
columnCount++;
}
@ -211,7 +211,7 @@ namespace System.Data.ProviderBase
foreach (DataColumn sourceColumn in sourceTable.Columns)
{
if (IncludeThisColumn(sourceColumn, hiddenColumnNames) == true)
if (IncludeThisColumn(sourceColumn, hiddenColumnNames))
{
DataColumn newDestinationColumn = new DataColumn(sourceColumn.ColumnName, sourceColumn.DataType);
destinationColumns.Add(newDestinationColumn);
@ -269,7 +269,7 @@ namespace System.Data.ProviderBase
{
if (collectionName == candidateCollectionName)
{
if (haveExactMatch == true)
if (haveExactMatch)
{
throw ADP.CollectionNameIsNotUnique(collectionName);
}
@ -304,7 +304,7 @@ namespace System.Data.ProviderBase
}
}
if ((haveExactMatch == false) && (haveMultipleInexactMatches == true))
if (!haveExactMatch && haveMultipleInexactMatches)
{
throw ADP.AmbigousCollectionName(collectionName);
}
@ -528,7 +528,7 @@ namespace System.Data.ProviderBase
}
// if the minmum version was ok what about the maximum version
if (result == true)
if (result)
{
versionColumn = tableColumns[_maximumVersion];
if (versionColumn != null)

View file

@ -115,7 +115,7 @@ namespace System.Net.Http
if (reader.TryCopyTo(temp))
{
bool result = TryRead(temp, out value, out int bytesRead);
Debug.Assert(result == true);
Debug.Assert(result);
Debug.Assert(bytesRead == length);
reader.Advance(bytesRead);
@ -190,7 +190,7 @@ namespace System.Net.Http
public static int WriteInteger(Span<byte> buffer, long longToEncode)
{
bool res = TryWrite(buffer, longToEncode, out int bytesWritten);
Debug.Assert(res == true);
Debug.Assert(res);
return bytesWritten;
}

View file

@ -38,7 +38,7 @@ namespace System.Net.Http.QPack
Span<byte> buffer = stackalloc byte[IntegerEncoder.MaxInt32EncodedLength];
bool res = EncodeStaticIndexedHeaderField(index, buffer, out int bytesWritten);
Debug.Assert(res == true);
Debug.Assert(res);
return buffer.Slice(0, bytesWritten).ToArray();
}
@ -93,7 +93,7 @@ namespace System.Net.Http.QPack
temp[0] = 0b01110000;
bool res = IntegerEncoder.Encode(index, 4, temp, out int headerBytesWritten);
Debug.Assert(res == true);
Debug.Assert(res);
return temp.Slice(0, headerBytesWritten).ToArray();
}
@ -102,7 +102,7 @@ namespace System.Net.Http.QPack
{
Span<byte> temp = value.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
bool res = EncodeLiteralHeaderFieldWithStaticNameReference(index, value, temp, out int bytesWritten);
Debug.Assert(res == true);
Debug.Assert(res);
return temp.Slice(0, bytesWritten).ToArray();
}
@ -168,7 +168,7 @@ namespace System.Net.Http.QPack
Span<byte> temp = name.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength] : new byte[name.Length + IntegerEncoder.MaxInt32EncodedLength];
bool res = EncodeNameString(name, temp, out int nameLength);
Debug.Assert(res == true);
Debug.Assert(res);
return temp.Slice(0, nameLength).ToArray();
}
@ -178,7 +178,7 @@ namespace System.Net.Http.QPack
Span<byte> temp = (name.Length + value.Length) < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[name.Length + value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
bool res = EncodeLiteralHeaderFieldWithoutNameReference(name, value, temp, out int bytesWritten);
Debug.Assert(res == true);
Debug.Assert(res);
return temp.Slice(0, bytesWritten).ToArray();
}

View file

@ -211,7 +211,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
public bool IsSealed()
{
return _isSealed == true;
return _isSealed;
}
public void SetSealed(bool @sealed)
@ -248,7 +248,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
public bool HasPubNoArgCtor()
{
return _hasPubNoArgCtor == true;
return _hasPubNoArgCtor;
}
public void SetHasPubNoArgCtor(bool hasPubNoArgCtor)
@ -258,7 +258,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
public bool IsSkipUDOps()
{
return _isSkipUDOps == true;
return _isSkipUDOps;
}
public void SetSkipUDOps(bool skipUDOps)

View file

@ -269,7 +269,7 @@ namespace System.ComponentModel.Composition.Hosting
{
set
{
if (value == true && _containsInnerAtomicComposition == true)
if (value && _containsInnerAtomicComposition)
{
throw new InvalidOperationException(SR.AtomicComposition_AlreadyNested);
}

View file

@ -183,7 +183,7 @@ namespace System.ComponentModel.Composition
{
get
{
if (AllowDefault == true)
if (AllowDefault)
{
return ImportCardinality.ZeroOrOne;
}

View file

@ -92,7 +92,7 @@ namespace System.ComponentModel.Design
Debug.Assert(_stream.Position != 0, "Expected the first byte to be read first");
if (_stream.Position == 1)
{
Debug.Assert(_readFirstByte == true);
Debug.Assert(_readFirstByte);
// Add the first byte read by ReadByte into buffer here
buffer[0] = _firstByte;
return _stream.Read(buffer.Slice(1)) + 1;

View file

@ -543,7 +543,7 @@ namespace System.Data
{
ForeignKeyConstraint? fk = c as ForeignKeyConstraint;
Debug.Assert(fk != null);
bool shouldSerialize = (allConstraints == true) || (fk.Table == this && fk.RelatedTable == this);
bool shouldSerialize = allConstraints || (fk.Table == this && fk.RelatedTable == this);
if (shouldSerialize)
{

View file

@ -983,7 +983,7 @@ namespace System.Data
break;
}
if ((bool)vLeft == true)
if ((bool)vLeft)
{
value = true;
break;

View file

@ -378,7 +378,7 @@ namespace System.Data
object first = _arguments![0].Eval(row, version);
if (DataExpression.ToBoolean(first) != false)
if (DataExpression.ToBoolean(first))
{
return _arguments[1].Eval(row, version);
}

View file

@ -139,7 +139,7 @@ namespace System.Data
}
else
{
if (DataExpression.ToBoolean(vl) != false)
if (DataExpression.ToBoolean(vl))
return false;
return true;
}

View file

@ -852,7 +852,7 @@ namespace System.Xml
Debug.Assert(!Convert.IsDBNull(row[_column, rowVersion]));
// If we are on the Text column, we should always have fOnValue == true
Debug.Assert((_column.ColumnMapping == MappingType.SimpleContent) ? (_fOnValue == true) : true);
Debug.Assert((_column.ColumnMapping == MappingType.SimpleContent) ? _fOnValue : true);
}
}

View file

@ -1664,7 +1664,7 @@ namespace System.Xml
Debug.Assert(!Convert.IsDBNull(row[_column, rowVersion]));
// If we are on the Text column, we should always have _fOnValue == true
Debug.Assert((_column.ColumnMapping == MappingType.SimpleContent) ? (_fOnValue == true) : true);
Debug.Assert((_column.ColumnMapping == MappingType.SimpleContent) ? _fOnValue : true);
}
if (_column == null)
Debug.Assert(!_fOnValue);

View file

@ -193,7 +193,7 @@ namespace System.Xml
[RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)]
private void BindForLoad()
{
Debug.Assert(_ignoreXmlEvents == true);
Debug.Assert(_ignoreXmlEvents);
_ignoreDataSetEvents = true;
_mapper.SetupMapping(this, _dataSet);
if (_dataSet.Tables.Count > 0)
@ -252,7 +252,7 @@ namespace System.Xml
[RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)]
private void UnBindSpecialListeners()
{
Debug.Assert(_fDataRowCreatedSpecial == true);
Debug.Assert(_fDataRowCreatedSpecial);
_dataSet.DataRowCreated -= new DataRowCreatedEventHandler(OnDataRowCreatedSpecial);
_fDataRowCreatedSpecial = false;
}
@ -504,7 +504,7 @@ namespace System.Xml
private XmlElement DemoteDocumentElement()
{
// Changes of Xml here should not affect ROM
Debug.Assert(_ignoreXmlEvents == true);
Debug.Assert(_ignoreXmlEvents);
// There should be no reason to call this function if docElem is not a rowElem
Debug.Assert(GetRowFromElement(DocumentElement) != null);
@ -1005,8 +1005,8 @@ namespace System.Xml
[RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)]
private XmlNode CloneTreeInternal(DataPointer other)
{
Debug.Assert(_ignoreDataSetEvents == true);
Debug.Assert(_ignoreXmlEvents == true);
Debug.Assert(_ignoreDataSetEvents);
Debug.Assert(_ignoreXmlEvents);
Debug.Assert(IsFoliationEnabled == false);
// Create the diconnected tree based on the other navigator
@ -1392,7 +1392,7 @@ namespace System.Xml
private void OnAddRow(DataRow row)
{
// Xml operations in this func should not trigger ROM operations
Debug.Assert(_ignoreXmlEvents == true);
Debug.Assert(_ignoreXmlEvents);
XmlBoundElement rowElement = (XmlBoundElement)(GetElementFromRow(row));
Debug.Assert(rowElement != null);
@ -1665,7 +1665,7 @@ namespace System.Xml
private void OnDeleteRow(DataRow row, XmlBoundElement rowElement)
{
// IgnoreXmlEvents s/b on since we are manipulating the XML tree and we not want this to reflect in ROM view.
Debug.Assert(_ignoreXmlEvents == true);
Debug.Assert(_ignoreXmlEvents);
// Special case when rowElem is document element: we create a new docElem, move the current one as a child of
// the new created docElem, then process as if the docElem is not a rowElem
if (rowElement == DocumentElement)
@ -1742,7 +1742,7 @@ namespace System.Xml
{
Debug.Assert(child.Element == childElement && childElement.Row == child);
// This function is (and s/b) called as a result of ROM changes, therefore XML changes done here should not be sync-ed to ROM
Debug.Assert(_ignoreXmlEvents == true);
Debug.Assert(_ignoreXmlEvents);
#if DEBUG
// In order to check that this move does not change the connected/disconnected state of the node
bool fChildElementConnected = IsConnected(childElement);
@ -1831,7 +1831,7 @@ namespace System.Xml
{
if (_ignoreXmlEvents)
return;
if (DataSet.EnforceConstraints != false)
if (DataSet.EnforceConstraints)
throw new InvalidOperationException(SR.DataDom_EnforceConstraintsShouldBeOff);
}
@ -1886,7 +1886,7 @@ namespace System.Xml
{
if (_ignoreXmlEvents)
return;
if (DataSet.EnforceConstraints != false)
if (DataSet.EnforceConstraints)
throw new InvalidOperationException(SR.DataDom_EnforceConstraintsShouldBeOff);
}
@ -1938,7 +1938,7 @@ namespace System.Xml
{
if (_ignoreXmlEvents)
return;
if (DataSet.EnforceConstraints != false)
if (DataSet.EnforceConstraints)
throw new InvalidOperationException(SR.DataDom_EnforceConstraintsShouldBeOff);
}
@ -2286,7 +2286,7 @@ namespace System.Xml
// prevSibling must have a parent, since we want to add a sibling to it
Debug.Assert(prevSibling.ParentNode != null);
Debug.Assert(IsFoliationEnabled == false);
Debug.Assert(IgnoreXmlEvents == true);
Debug.Assert(IgnoreXmlEvents);
// Should not insert after docElem node
Debug.Assert(prevSibling != DocumentElement);

View file

@ -546,8 +546,7 @@ namespace System.Data.ProviderBase
// postcondition
// ensure that the connection was processed
Debug.Assert(
returnToGeneralPool == true || destroyObject == true);
Debug.Assert(returnToGeneralPool || destroyObject);
}
internal void DestroyObject(DbConnectionInternal obj)

View file

@ -985,7 +985,7 @@ namespace System.Data.Odbc
{
// upgrade unsigned types to be able to hold data that has the highest bit set
//
if (unsigned == true)
if (unsigned)
{
return typeMap._dbType switch
{

View file

@ -604,7 +604,7 @@ namespace System.Data.Odbc
{
info._dbtype = unchecked((ODBC32.SQL_TYPE)(int)GetColAttribute(i, ODBC32.SQL_DESC.CONCISE_TYPE, ODBC32.SQL_COLUMN.TYPE, ODBC32.HANDLER.THROW));
typeMap = TypeMap.FromSqlType(info._dbtype.Value);
if (typeMap._signType == true)
if (typeMap._signType)
{
bool sign = (GetColAttribute(i, ODBC32.SQL_DESC.UNSIGNED, ODBC32.SQL_COLUMN.UNSIGNED, ODBC32.HANDLER.THROW).ToInt64() != 0);
typeMap = TypeMap.UpgradeSignedType(typeMap, sign);
@ -2040,7 +2040,7 @@ namespace System.Data.Odbc
// furthermore size needs to be special cased for wchar types
//
typeMap = TypeMap.FromSqlType((ODBC32.SQL_TYPE)unchecked((int)GetColAttribute(i, ODBC32.SQL_DESC.CONCISE_TYPE, ODBC32.SQL_COLUMN.TYPE, ODBC32.HANDLER.THROW)));
if (typeMap._signType == true)
if (typeMap._signType)
{
bool sign = (GetColAttribute(i, ODBC32.SQL_DESC.UNSIGNED, ODBC32.SQL_COLUMN.UNSIGNED, ODBC32.HANDLER.THROW).ToInt64() != 0);
// sign = true if the column is unsigned
@ -2749,16 +2749,16 @@ namespace System.Data.Odbc
int idx;
CStringTokenizer tokenstmt = new CStringTokenizer(localcmdtext, Connection!.QuoteChar(ADP.GetSchemaTable)[0], Connection.EscapeChar(ADP.GetSchemaTable));
if (tokenstmt.StartsWith("select") == true)
if (tokenstmt.StartsWith("select"))
{
// select command, search for from clause
idx = tokenstmt.FindTokenIndex("from");
}
else
{
if ((tokenstmt.StartsWith("insert") == true) ||
(tokenstmt.StartsWith("update") == true) ||
(tokenstmt.StartsWith("delete") == true))
if (tokenstmt.StartsWith("insert") ||
tokenstmt.StartsWith("update") ||
tokenstmt.StartsWith("delete"))
{
// Get the following word
idx = tokenstmt.CurrentPosition;

View file

@ -441,7 +441,7 @@ namespace System.Data.Odbc
reader.GetValues(values);
if (IncludeIndexRow(values[positionOfIndexName],
restrictionIndexName,
Convert.ToInt16(values[positionOfType], null)) == true)
Convert.ToInt16(values[positionOfType], null)))
{
resultTable.Rows.Add(values);
}
@ -463,8 +463,8 @@ namespace System.Data.Odbc
// the column type should always be short but need to check just in case
if (values[positionOfColumnType].GetType() == typeof(short))
{
if ((((short)values[positionOfColumnType] == ODBC32.SQL_RESULT_COL) && (isColumn == true)) ||
(((short)values[positionOfColumnType] != ODBC32.SQL_RESULT_COL) && (isColumn == false)))
if ((((short)values[positionOfColumnType] == ODBC32.SQL_RESULT_COL) && isColumn) ||
(((short)values[positionOfColumnType] != ODBC32.SQL_RESULT_COL) && !isColumn))
{
resultTable.Rows.Add(values);
}
@ -900,7 +900,7 @@ namespace System.Data.Odbc
dataReader = command.ExecuteReaderFromSQLMethod(allRestrictions, ODBC32.SQL_API.SQLPROCEDURECOLUMNS);
string collectionName;
if (isColumns == true)
if (isColumns)
{
collectionName = OdbcMetaDataCollectionNames.ProcedureColumns;
}
@ -1046,7 +1046,7 @@ namespace System.Data.Odbc
//command = (OdbcCommand) connection.CreateCommand();
command = GetCommand(connection);
string[] allArguments = new string[tablesRestrictionsCount + 1];
if (isTables == true)
if (isTables)
{
includedTableTypes = includedTableTypesTables;
dataTableName = OdbcMetaDataCollectionNames.Tables;

View file

@ -364,7 +364,7 @@ namespace System.Data.OleDb
// otherwise get them from the provider
string quotePrefix = QuotePrefix;
string quoteSuffix = QuoteSuffix;
if (ADP.IsEmpty(quotePrefix) == true)
if (ADP.IsEmpty(quotePrefix))
{
if (connection == null)
{
@ -414,7 +414,7 @@ namespace System.Data.OleDb
// otherwise get them from the provider
string quotePrefix = QuotePrefix;
string quoteSuffix = QuoteSuffix;
if (ADP.IsEmpty(quotePrefix) == true)
if (ADP.IsEmpty(quotePrefix))
{
if (connection == null)
{

View file

@ -880,7 +880,7 @@ namespace System.Data.ProviderBase
// postcondition
// ensure that the connection was processed
Debug.Assert(rootTxn == true || returnToGeneralPool == true || destroyObject == true);
Debug.Assert(rootTxn || returnToGeneralPool || destroyObject);
// TODO: BID trace processing state?
}

View file

@ -92,7 +92,7 @@ namespace System.Data.ProviderBase
foreach (DataRow row in sourceTable.Rows)
{
if (SupportedByCurrentVersion(row) == true)
if (SupportedByCurrentVersion(row))
{
newRow = destinationTable.NewRow();
for (int i = 0; i < destinationColumns.Count; i++)
@ -218,7 +218,7 @@ namespace System.Data.ProviderBase
int columnCount = 0;
foreach (DataColumn sourceColumn in sourceTable.Columns)
{
if (IncludeThisColumn(sourceColumn, hiddenColumnNames) == true)
if (IncludeThisColumn(sourceColumn, hiddenColumnNames))
{
columnCount++;
}
@ -234,7 +234,7 @@ namespace System.Data.ProviderBase
foreach (DataColumn sourceColumn in sourceTable.Columns)
{
if (IncludeThisColumn(sourceColumn, hiddenColumnNames) == true)
if (IncludeThisColumn(sourceColumn, hiddenColumnNames))
{
newDestinationColumn = new DataColumn(sourceColumn.ColumnName, sourceColumn.DataType);
destinationColumns.Add(newDestinationColumn);
@ -291,7 +291,7 @@ namespace System.Data.ProviderBase
{
if (collectionName == candidateCollectionName)
{
if (haveExactMatch == true)
if (haveExactMatch)
{
throw ADP.CollectionNameIsNotUnique(collectionName);
}
@ -326,7 +326,7 @@ namespace System.Data.ProviderBase
}
}
if ((haveExactMatch == false) && (haveMultipleInexactMatches == true))
if (!haveExactMatch && haveMultipleInexactMatches)
{
throw ADP.AmbigousCollectionName(collectionName);
}
@ -540,7 +540,7 @@ namespace System.Data.ProviderBase
}
// if the minmum version was ok what about the maximum version
if (result == true)
if (result)
{
versionColumn = tableColumns[_maximumVersion];
if (versionColumn != null)

View file

@ -35,12 +35,12 @@ namespace System.Diagnostics.Eventing.Reader
internal void PrepareData()
{
if (_dataReady == true)
if (_dataReady)
return;
lock (_syncObject)
{
if (_dataReady == true)
if (_dataReady)
return;
IEnumerable<EventKeyword> result = _pmReference.Keywords;

View file

@ -35,12 +35,12 @@ namespace System.Diagnostics.Eventing.Reader
internal void PrepareData()
{
if (_dataReady == true)
if (_dataReady)
return;
lock (_syncObject)
{
if (_dataReady == true)
if (_dataReady)
return;
IEnumerable<EventLevel> result = _pmReference.Levels;

View file

@ -39,12 +39,12 @@ namespace System.Diagnostics.Eventing.Reader
private void PrepareData()
{
if (_dataReady == true)
if (_dataReady)
return;
lock (_syncObject)
{
if (_dataReady == true)
if (_dataReady)
return;
IEnumerable<EventLogLink> result = _pmReference.LogLinks;

View file

@ -343,11 +343,11 @@ namespace System.Diagnostics.Eventing.Reader
{
get
{
if (_taskNameReady == true)
if (_taskNameReady)
return _taskName;
lock (_syncObject)
{
if (_taskNameReady == false)
if (!_taskNameReady)
{
_taskNameReady = true;
_taskName = _cachedMetadataInformation.GetTaskDisplayName(this.ProviderName, Handle);

View file

@ -39,7 +39,7 @@ namespace System.Diagnostics.Eventing.Reader
{
lock (_syncObject)
{
if (_dataReady == true)
if (_dataReady)
return;
// Get the data

View file

@ -39,7 +39,7 @@ namespace System.Diagnostics.Eventing.Reader
{
lock (_syncObject)
{
if (_dataReady == true)
if (_dataReady)
return;
IEnumerable<EventTask> result = _pmReference.Tasks;

View file

@ -597,10 +597,7 @@ namespace System.Diagnostics.Eventing.Reader
case UnsafeNativeMethods.EvtChannelConfigPropertyId.EvtChannelConfigEnabled:
{
varVal.Type = (uint)UnsafeNativeMethods.EvtVariantType.EvtVarTypeBoolean;
if ((bool)val == true)
varVal.Bool = 1;
else
varVal.Bool = 0;
varVal.Bool = (bool)val ? 1u : 0u;
}
break;
case UnsafeNativeMethods.EvtChannelConfigPropertyId.EvtChannelConfigAccess:
@ -638,19 +635,13 @@ namespace System.Diagnostics.Eventing.Reader
case UnsafeNativeMethods.EvtChannelConfigPropertyId.EvtChannelLoggingConfigRetention:
{
varVal.Type = (uint)UnsafeNativeMethods.EvtVariantType.EvtVarTypeBoolean;
if ((bool)val == true)
varVal.Bool = 1;
else
varVal.Bool = 0;
varVal.Bool = (bool)val ? 1u : 0u;
}
break;
case UnsafeNativeMethods.EvtChannelConfigPropertyId.EvtChannelLoggingConfigAutoBackup:
{
varVal.Type = (uint)UnsafeNativeMethods.EvtVariantType.EvtVarTypeBoolean;
if ((bool)val == true)
varVal.Bool = 1;
else
varVal.Bool = 0;
varVal.Bool = (bool)val ? 1u : 0u;
}
break;
default:

View file

@ -816,7 +816,7 @@ namespace System.DirectoryServices.AccountManagement
private bool ExpandForeignGroupEnumerator()
{
Debug.Assert(_recursive == true);
Debug.Assert(_recursive);
GlobalDebug.WriteLineIf(GlobalDebug.Info,
"ADDNLinkedAttrSet",
"ExpandForeignGroupEnumerator: there are {0} foreignGroups",
@ -846,7 +846,7 @@ namespace System.DirectoryServices.AccountManagement
private bool ExpandForeignGroupSearcher()
{
Debug.Assert(_recursive == true);
Debug.Assert(_recursive);
GlobalDebug.WriteLineIf(GlobalDebug.Info,
"ADDNLinkedAttrSet",
"ExpandForeignGroupSearcher: there are {0} foreignGroups",

View file

@ -364,8 +364,8 @@ namespace System.DirectoryServices.AccountManagement
{
try
{
Debug.Assert(p.unpersisted == true);
Debug.Assert(p.fakePrincipal == false);
Debug.Assert(p.unpersisted);
Debug.Assert(!p.fakePrincipal);
// Insert the principal into the store
SDSUtils.InsertPrincipal(
@ -795,8 +795,8 @@ namespace System.DirectoryServices.AccountManagement
internal override void InitializeUserAccountControl(AuthenticablePrincipal p)
{
Debug.Assert(p != null);
Debug.Assert(p.fakePrincipal == false);
Debug.Assert(p.unpersisted == true); // should only ever be called for new principals
Debug.Assert(!p.fakePrincipal);
Debug.Assert(p.unpersisted); // should only ever be called for new principals
// set the userAccountControl bits on the underlying directory entry
DirectoryEntry de = (DirectoryEntry)p.UnderlyingObject;
@ -1619,7 +1619,7 @@ namespace System.DirectoryServices.AccountManagement
try
{
if (true == ADUtils.VerifyOutboundTrust(this.DnsDomainName, (this.credentials == null ? null : this.credentials.UserName), (this.credentials == null ? null : this.credentials.Password)))
if (ADUtils.VerifyOutboundTrust(this.DnsDomainName, this.credentials?.UserName, this.credentials?.Password))
{
return new AuthZSet(sid, this.credentials, this.contextOptions, this.FlatDomainName, this, this.ctxBase);
}

View file

@ -188,7 +188,7 @@ namespace System.DirectoryServices.AccountManagement
// opposite order and the other thread woke up before we inserted the PrincipalContext, it would
// just block as soon as it tries to acquire the tableLock that we're currently holding.)
bool f = placeHolder.contextReadyEvent.Set();
Debug.Assert(f == true);
Debug.Assert(f);
}
return ctx;

View file

@ -444,7 +444,7 @@ namespace System.DirectoryServices.AccountManagement
// to add some type of tag to the property names to differentiate them here
bool? val = rosf.GetChangeStatusForProperty(propertyName);
if (val.HasValue == true)
if (val.HasValue)
return val.Value;
if (propertyName.StartsWith(PropertyNames.AcctInfoPrefix, StringComparison.Ordinal))

View file

@ -26,7 +26,7 @@ namespace System.DirectoryServices.AccountManagement
CheckDisposed();
if (_beforeStart == true || _endReached == true || _resultSet == null)
if (_beforeStart || _endReached || _resultSet == null)
{
// Either we're before the beginning or after the end of the collection.
GlobalDebug.WriteLineIf(
@ -84,7 +84,7 @@ namespace System.DirectoryServices.AccountManagement
lock (_resultSet)
{
// If before the first ResultSet, move to the first ResultSet
if (_beforeStart == true)
if (_beforeStart)
{
GlobalDebug.WriteLineIf(GlobalDebug.Info, "FindResultEnumerator", "MoveNext: Moving to first resultSet");

View file

@ -310,7 +310,7 @@ namespace System.DirectoryServices.AccountManagement
return (_storedNewPassword != null);
case (PropertyNames.PwdInfoExpireImmediately):
return (_expirePasswordImmediately != false);
return (_expirePasswordImmediately);
default:
Debug.Fail($"PasswordInfo.GetChangeStatusForProperty: fell off end looking for {propertyName}");

View file

@ -32,7 +32,7 @@ namespace System.DirectoryServices.AccountManagement
CheckDisposedOrDeleted();
// The only way we can't have a PrincipalContext is if we're unpersisted
Debug.Assert(_ctx != null || this.unpersisted == true);
Debug.Assert(_ctx != null || this.unpersisted);
return _ctx;
}
@ -47,7 +47,7 @@ namespace System.DirectoryServices.AccountManagement
CheckDisposedOrDeleted();
// The only way we can't have a PrincipalContext is if we're unpersisted
Debug.Assert(_ctx != null || this.unpersisted == true);
Debug.Assert(_ctx != null || this.unpersisted);
if (_ctx == null)
throw new InvalidOperationException(SR.PrincipalMustSetContextForProperty);
@ -303,7 +303,7 @@ namespace System.DirectoryServices.AccountManagement
// and they never set a PrincipalContext.
if (_ctx == null)
{
Debug.Assert(this.unpersisted == true);
Debug.Assert(this.unpersisted);
throw new InvalidOperationException(SR.PrincipalMustSetContextForSave);
}
@ -340,7 +340,7 @@ namespace System.DirectoryServices.AccountManagement
// and they never set a PrincipalContext.
if (context == null)
{
Debug.Assert(this.unpersisted == true);
Debug.Assert(this.unpersisted);
throw new InvalidOperationException(SR.NullArguments);
}
@ -360,7 +360,7 @@ namespace System.DirectoryServices.AccountManagement
// context is of the same type.
if (context.ContextType != _ctx.ContextType)
{
Debug.Assert(this.unpersisted == true);
Debug.Assert(this.unpersisted);
throw new InvalidOperationException(SR.SaveToMustHaveSamecontextType);
}
@ -802,7 +802,7 @@ namespace System.DirectoryServices.AccountManagement
{
if (_ctx == null)
{
Debug.Assert(this.unpersisted == true);
Debug.Assert(this.unpersisted);
return null;
}

View file

@ -326,7 +326,7 @@ namespace System.DirectoryServices.AccountManagement
StoreCtx storeCtxToUse = _owningGroup.GetStoreCtxToUse();
string explanation;
Debug.Assert(storeCtxToUse != null || _owningGroup.unpersisted == true);
Debug.Assert(storeCtxToUse != null || _owningGroup.unpersisted);
if ((storeCtxToUse != null) && (!storeCtxToUse.CanGroupBeCleared(_owningGroup, out explanation)))
throw new InvalidOperationException(explanation);
@ -379,7 +379,7 @@ namespace System.DirectoryServices.AccountManagement
StoreCtx storeCtxToUse = _owningGroup.GetStoreCtxToUse();
string explanation;
Debug.Assert(storeCtxToUse != null || _owningGroup.unpersisted == true);
Debug.Assert(storeCtxToUse != null || _owningGroup.unpersisted);
if ((storeCtxToUse != null) && (!storeCtxToUse.CanGroupMemberBeRemoved(_owningGroup, principal, out explanation)))
throw new InvalidOperationException(explanation);

View file

@ -23,7 +23,7 @@ namespace System.DirectoryServices.AccountManagement
// Since MoveNext() saved off the current value for us, this is largely trivial.
if (_endReached == true || _currentMode == CurrentEnumeratorMode.None)
if (_endReached || _currentMode == CurrentEnumeratorMode.None)
{
// Either we're at the end or before the beginning
// (CurrentEnumeratorMode.None implies we're _before_ the first value)

View file

@ -301,7 +301,7 @@ namespace System.DirectoryServices.AccountManagement
// Since the QBE filter must be in the "unpersisted" state, any set properties have their changed
// flag still set (qbeFilter.GetChangeStatusForProperty() == true). Therefore, checking which properties
// have been set == checking which properties have their change flag set to true.
Debug.Assert(_qbeFilter.unpersisted == true);
Debug.Assert(_qbeFilter.unpersisted);
// Retrieve the list of referential properties for this type of Principal.
// If this type of Principal doesn't have any, the Properties hashtable will return null.
@ -315,7 +315,7 @@ namespace System.DirectoryServices.AccountManagement
{
foreach (string propertyName in referentialProperties)
{
if (_qbeFilter.GetChangeStatusForProperty(propertyName) == true)
if (_qbeFilter.GetChangeStatusForProperty(propertyName))
{
// Property was set.
GlobalDebug.WriteLineIf(GlobalDebug.Warn, "PrincipalSearcher", "HasReferentialPropertiesSet: found ref property " + propertyName);

View file

@ -323,7 +323,7 @@ namespace System.DirectoryServices.AccountManagement
// We're expanding recursively, and either (1) we're immediately before
// the recursive expansion of the first foreign group, or (2) we just completed
// the recursive expansion of a foreign group, and now are moving on to the next.
Debug.Assert(_recursive == true);
Debug.Assert(_recursive);
// Pull off a foreign group to expand.
GroupPrincipal foreignGroup = _foreignGroups[0];
@ -339,7 +339,7 @@ namespace System.DirectoryServices.AccountManagement
// that we started on a previous call to MoveNext().
if (_foreignResultSet != null)
{
Debug.Assert(_recursive == true);
Debug.Assert(_recursive);
bool f = _foreignResultSet.MoveNext();

View file

@ -219,8 +219,8 @@ namespace System.DirectoryServices.AccountManagement
// have been set, prior to persisting the Principal.
internal override void Insert(Principal p)
{
Debug.Assert(p.unpersisted == true);
Debug.Assert(p.fakePrincipal == false);
Debug.Assert(p.unpersisted);
Debug.Assert(!p.fakePrincipal);
try
{
@ -368,8 +368,8 @@ namespace System.DirectoryServices.AccountManagement
internal override void InitializeUserAccountControl(AuthenticablePrincipal p)
{
Debug.Assert(p != null);
Debug.Assert(p.fakePrincipal == false);
Debug.Assert(p.unpersisted == true); // should only ever be called for new principals
Debug.Assert(!p.fakePrincipal);
Debug.Assert(p.unpersisted); // should only ever be called for new principals
// set the userAccountControl bits on the underlying directory entry
DirectoryEntry de = (DirectoryEntry)p.UnderlyingObject;

View file

@ -22,7 +22,7 @@ namespace System.DirectoryServices.AccountManagement
// Since MoveNext() saved off the current value for us, this is largely trivial.
if (_endReached == true || _enumerator == null)
if (_endReached || _enumerator == null)
{
// Either we're at the end or before the beginning
GlobalDebug.WriteLineIf(GlobalDebug.Warn, "TrackedCollectionEnumerator", "Current: bad position, endReached={0}", _endReached);

View file

@ -312,7 +312,7 @@ namespace System.DirectoryServices.AccountManagement
bool success = Interop.Advapi32.EqualDomainSid(pCopyOfUserSid, pMachineDomainSid, ref sameDomain);
// Since both pCopyOfUserSid and pMachineDomainSid should always be account SIDs
Debug.Assert(success == true);
Debug.Assert(success);
// If user SID is the same domain as the machine domain, and the machine is not a DC then the user is a local (machine) user
return sameDomain ? !IsMachineDC(null) : false;

View file

@ -1226,7 +1226,7 @@ namespace System.DirectoryServices.Protocols
var controlList = new ArrayList();
foreach (DirectoryControl col in controls)
{
if (serverControl == true)
if (serverControl)
{
if (col.ServerSide)
{

View file

@ -172,7 +172,7 @@ namespace System.DirectoryServices.ActiveDirectory
internal ActiveDirectorySite(DirectoryContext context, string siteName, bool existing)
{
Debug.Assert(existing == true);
Debug.Assert(existing);
this.context = context;
_name = siteName;

View file

@ -376,7 +376,7 @@ namespace System.DirectoryServices.ActiveDirectory
}
//NTDSSITELINK_OPT_TWOWAY_SYNC ( 1 << 1 ) force sync in opposite direction at end of sync
if (value == true)
if (value)
{
options |= 0x2;
}

View file

@ -169,7 +169,7 @@ namespace System.DirectoryServices.ActiveDirectory
internal ActiveDirectorySubnet(DirectoryContext context, string subnetName, string? siteName, bool existing)
{
Debug.Assert(existing == true);
Debug.Assert(existing);
this.context = context;
_name = subnetName;

View file

@ -495,7 +495,7 @@ namespace System.DirectoryServices.ActiveDirectory
}
// NTDSCONN_OPT_TWOWAY_SYNC ( 1 << 1 ) force sync in opposite direction at end of sync
if (value == true)
if (value)
{
_options |= 0x2;
}
@ -721,7 +721,7 @@ namespace System.DirectoryServices.ActiveDirectory
}
// NTDSCONN_OPT_USER_OWNED_SCHEDULE (1 << 5)
if (value == true)
if (value)
{
_options |= 0x20;
}

View file

@ -1951,7 +1951,7 @@ namespace System.DirectoryServices.ActiveDirectory
//extract IPv6 port number if any
bool isBrace = serverName.StartsWith("[", StringComparison.Ordinal);
if (isBrace == true)
if (isBrace)
{
if (serverName.EndsWith("]", StringComparison.Ordinal))
{
@ -2049,7 +2049,7 @@ namespace System.DirectoryServices.ActiveDirectory
bool success = global::Interop.Advapi32.EqualDomainSid(pCopyOfUserSid, pMachineDomainSid, ref sameDomain);
// Since both pCopyOfUserSid and pMachineDomainSid should always be account SIDs
Debug.Assert(success == true);
Debug.Assert(success);
// If user SID is the same domain as the machine domain, and the machine is not a DC then the user is a local (machine) user
return sameDomain ? !IsMachineDC(null) : false;

View file

@ -156,7 +156,7 @@ namespace System.DirectoryServices
set
{
// user explicitly set CacheResults to true and also want VLV
if (directoryVirtualListViewSpecified == true && value == true)
if (directoryVirtualListViewSpecified && value)
throw new ArgumentException(SR.DSBadCacheResultsVLV);
_cacheResults = value;
@ -220,7 +220,7 @@ namespace System.DirectoryServices
throw new ArgumentException(SR.DSBadPageSize);
// specify non-zero pagesize explicitly and also want dirsync
if (directorySynchronizationSpecified == true && value != 0)
if (directorySynchronizationSpecified && value != 0)
throw new ArgumentException(SR.DSBadPageSizeDirsync);
_pageSize = value;
@ -277,7 +277,7 @@ namespace System.DirectoryServices
throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(SearchScope));
// user explicitly set SearchScope to something other than Base and also want to do ASQ, it is not supported
if (_attributeScopeQuerySpecified == true && value != SearchScope.Base)
if (_attributeScopeQuerySpecified && value != SearchScope.Base)
{
throw new ArgumentException(SR.DSBadASQSearchScope);
}
@ -419,7 +419,7 @@ namespace System.DirectoryServices
// user explicitly set AttributeScopeQuery and value is not null or empty string
if (value.Length != 0)
{
if (_scopeSpecified == true && SearchScope != SearchScope.Base)
if (_scopeSpecified && SearchScope != SearchScope.Base)
{
throw new ArgumentException(SR.DSBadASQSearchScope);
}
@ -556,7 +556,7 @@ namespace System.DirectoryServices
// if user explicitly set CacheResults to true and also want to set VLV
if (value != null)
{
if (_cacheResultsSpecified == true && CacheResults == true)
if (_cacheResultsSpecified && CacheResults)
throw new ArgumentException(SR.DSBadCacheResultsVLV);
directoryVirtualListViewSpecified = true;
@ -733,7 +733,7 @@ namespace System.DirectoryServices
prefList.Add(info);
// asynchronous
if (Asynchronous == true)
if (Asynchronous)
{
info = default;
info.dwSearchPref = (int)AdsSearchPreferences.ASYNCHRONOUS;
@ -742,7 +742,7 @@ namespace System.DirectoryServices
}
// tombstone
if (Tombstone == true)
if (Tombstone)
{
info = default;
info.dwSearchPref = (int)AdsSearchPreferences.TOMBSTONE;

View file

@ -300,25 +300,25 @@ namespace System.Drawing
if ((value = propertyValues["Bold"]) != null)
{
if ((bool)value == true)
if ((bool)value)
style |= FontStyle.Bold;
}
if ((value = propertyValues["Italic"]) != null)
{
if ((bool)value == true)
if ((bool)value)
style |= FontStyle.Italic;
}
if ((value = propertyValues["Strikeout"]) != null)
{
if ((bool)value == true)
if ((bool)value)
style |= FontStyle.Strikeout;
}
if ((value = propertyValues["Underline"]) != null)
{
if ((bool)value == true)
if ((bool)value)
style |= FontStyle.Underline;
}

View file

@ -97,10 +97,7 @@ namespace System.Drawing.Imaging
{
_parameterGuid = encoder.Guid;
if (undefined == true)
_parameterValueType = EncoderParameterValueType.ValueTypeUndefined;
else
_parameterValueType = EncoderParameterValueType.ValueTypeByte;
_parameterValueType = undefined ? EncoderParameterValueType.ValueTypeUndefined : EncoderParameterValueType.ValueTypeByte;
_numberOfValues = 1;
_parameterValue = Marshal.AllocHGlobal(sizeof(byte));
@ -202,10 +199,7 @@ namespace System.Drawing.Imaging
{
_parameterGuid = encoder.Guid;
if (undefined == true)
_parameterValueType = EncoderParameterValueType.ValueTypeUndefined;
else
_parameterValueType = EncoderParameterValueType.ValueTypeByte;
_parameterValueType = undefined ? EncoderParameterValueType.ValueTypeUndefined : EncoderParameterValueType.ValueTypeByte;
_numberOfValues = value.Length;
_parameterValue = Marshal.AllocHGlobal(_numberOfValues);

View file

@ -108,7 +108,7 @@ namespace System.Security.AccessControl
continue;
}
if (ace.IsCallback == true)
if (ace.IsCallback)
{
//
// Ignore callback ACEs
@ -162,7 +162,7 @@ namespace System.Security.AccessControl
}
}
if (ace.IsCallback == true)
if (ace.IsCallback)
{
//
// Ignore callback ACEs

View file

@ -837,7 +837,7 @@ namespace System.IO.Packaging
// In addition we need to make sure that the relationship is not created by taking another relationship
// as the source of this uri. So XXX/_rels/_rels/YYY.rels.rels would be invalid.
if (segments.Length > 3 && result == true)
if (segments.Length > 3 && result)
{
if ((segments[segments.Length - 1]).EndsWith(RelsrelsUpperCaseExtension, StringComparison.Ordinal))
{

View file

@ -993,7 +993,7 @@ namespace System.IO.Packaging
//Throw if the object is in a disposed state
private void ThrowIfObjectDisposed()
{
if (_disposed == true)
if (_disposed)
throw new ObjectDisposedException(null, SR.ObjectDisposed);
}

View file

@ -722,7 +722,7 @@ namespace System.IO.Packaging
//If the part has been deleted then we throw
private void ThrowIfPackagePartDeleted()
{
if (_deleted == true)
if (_deleted)
throw new InvalidOperationException(SR.PackagePartDeleted);
}

View file

@ -144,7 +144,7 @@ namespace System.IO.Ports
set
{
int fNullFlag = GetDcbFlag(Interop.Kernel32.DCBFlags.FNULL);
if (value == true && fNullFlag == 0 || value == false && fNullFlag == 1)
if (value && fNullFlag == 0 || !value && fNullFlag == 1)
{
int fNullOld = fNullFlag;
SetDcbFlag(Interop.Kernel32.DCBFlags.FNULL, value ? 1 : 0);
@ -880,7 +880,7 @@ namespace System.IO.Ports
try
{
wh.WaitOne();
Debug.Assert(afsar._isComplete == true, "SerialStream::EndRead - AsyncFSCallback didn't set _isComplete to true!");
Debug.Assert(afsar._isComplete, "SerialStream::EndRead - AsyncFSCallback didn't set _isComplete to true!");
// InfiniteTimeout is not something native to the underlying serial device,
// we specify the timeout to be a very large value (MAXWORD-1) to achieve
@ -958,7 +958,7 @@ namespace System.IO.Ports
try
{
wh.WaitOne();
Debug.Assert(afsar._isComplete == true, "SerialStream::EndWrite - AsyncFSCallback didn't set _isComplete to true!");
Debug.Assert(afsar._isComplete, "SerialStream::EndWrite - AsyncFSCallback didn't set _isComplete to true!");
}
finally
{

View file

@ -2573,7 +2573,7 @@ namespace System.Management
}
//Have we already got this object
if (!IsBound && (getObject == true))
if (!IsBound && getObject)
needToGetObject = true;
if (null == scope)
@ -2613,7 +2613,7 @@ namespace System.Management
scope.Initialize();
// If we have just connected, make sure we get the object
if (getObject == true)
if (getObject)
{
needToGetObject = true;
}

View file

@ -145,7 +145,7 @@ namespace System.Management
int count = 0;
IEnumerator enumCol = this.GetEnumerator();
while (enumCol.MoveNext() == true)
while (enumCol.MoveNext())
{
count++;
}
@ -287,7 +287,7 @@ namespace System.Management
// Unless this is the first enumerator, we have
// to clone. This may throw if we are non-rewindable.
if (this.options.Rewindable == true)
if (this.options.Rewindable)
{
IEnumWbemClassObject enumWbemClone = null;
int status = (int)ManagementStatus.NoError;

View file

@ -335,7 +335,7 @@ namespace System.Management
if ((query.GetType() == typeof(SelectQuery)) &&
(((SelectQuery)query).Condition == null) &&
(((SelectQuery)query).SelectedProperties == null) &&
(options.EnumerateDeep == true))
options.EnumerateDeep)
{
//Need to make sure that we're not passing invalid flags to enumeration APIs.
//The only flags not valid for enumerations are EnsureLocatable & PrototypeOnly.
@ -428,7 +428,7 @@ namespace System.Management
if ((query.GetType() == typeof(SelectQuery)) &&
(((SelectQuery)query).Condition == null) &&
(((SelectQuery)query).SelectedProperties == null) &&
(options.EnumerateDeep == true))
options.EnumerateDeep)
{
//Need to make sure that we're not passing invalid flags to enumeration APIs.
//The only flags not valid for enumerations are EnsureLocatable & PrototypeOnly.

View file

@ -381,8 +381,8 @@ namespace System.Management
get { return (((Flags & (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_FORWARD_ONLY) != 0) ? false : true); }
set
{
Flags = (value == true) ? (Flags & (int)~tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_FORWARD_ONLY) :
(Flags | (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_FORWARD_ONLY);
Flags = value ? (Flags & (int)~tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_FORWARD_ONLY) :
(Flags | (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_FORWARD_ONLY);
}
}
@ -408,8 +408,8 @@ namespace System.Management
get { return (((Flags & (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS) != 0) ? true : false); }
set
{
Flags = (value == true) ? (Flags | (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS) :
(Flags & (int)~tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS);
Flags = value ? (Flags | (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS) :
(Flags & (int)~tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS);
}
}
@ -431,8 +431,8 @@ namespace System.Management
{ return (((Flags & (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_ENSURE_LOCATABLE) != 0) ? true : false); }
set
{
Flags = (value == true) ? (Flags | (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_ENSURE_LOCATABLE) :
(Flags & (int)~tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_ENSURE_LOCATABLE);
Flags = value ? (Flags | (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_ENSURE_LOCATABLE) :
(Flags & (int)~tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_ENSURE_LOCATABLE);
}
}
@ -454,8 +454,8 @@ namespace System.Management
{ return (((Flags & (int)tag_WBEM_QUERY_FLAG_TYPE.WBEM_FLAG_PROTOTYPE) != 0) ? true : false); }
set
{
Flags = (value == true) ? (Flags | (int)tag_WBEM_QUERY_FLAG_TYPE.WBEM_FLAG_PROTOTYPE) :
(Flags & (int)~tag_WBEM_QUERY_FLAG_TYPE.WBEM_FLAG_PROTOTYPE);
Flags = value ? (Flags | (int)tag_WBEM_QUERY_FLAG_TYPE.WBEM_FLAG_PROTOTYPE) :
(Flags & (int)~tag_WBEM_QUERY_FLAG_TYPE.WBEM_FLAG_PROTOTYPE);
}
}
@ -475,8 +475,8 @@ namespace System.Management
{ return (((Flags & (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_DIRECT_READ) != 0) ? true : false); }
set
{
Flags = (value == true) ? (Flags | (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_DIRECT_READ) :
(Flags & (int)~tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_DIRECT_READ);
Flags = value ? (Flags | (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_DIRECT_READ) :
(Flags & (int)~tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_DIRECT_READ);
}
}
@ -817,8 +817,8 @@ namespace System.Management
get { return (((Flags & (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS) != 0) ? true : false); }
set
{
Flags = (value == true) ? (Flags | (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS) :
(Flags & (int)~tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS);
Flags = value ? (Flags | (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS) :
(Flags & (int)~tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS);
FireIdentifierChanged();
}
}
@ -950,8 +950,8 @@ namespace System.Management
get { return (((Flags & (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS) != 0) ? true : false); }
set
{
Flags = (value == true) ? (Flags | (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS) :
(Flags & (int)~tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS);
Flags = value ? (Flags | (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS) :
(Flags & (int)~tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_USE_AMENDED_QUALIFIERS);
}
}

View file

@ -32,7 +32,7 @@ namespace System.Management
{
if (s_allowManagementObjectQI == 0)
{
s_allowManagementObjectQI = GetSwitchValueFromRegistry() == true ? 1 : -1;
s_allowManagementObjectQI = GetSwitchValueFromRegistry() ? 1 : -1;
}
}
}

View file

@ -140,7 +140,7 @@ namespace System.Management
{
CodeTypeDeclaration retType;
if (systemPropertyClass == true)
if (systemPropertyClass)
{
//Initialize the public attributes . private variables
InitilializePublicPrivateMembers();
@ -364,7 +364,7 @@ namespace System.Management
GenerateDefaultConstructor();
GenerateInitializeObject();
if (bSingletonClass == true)
if (bSingletonClass)
{
//Now Generate a constructor which accepts only the scope
GenerateConstructorWithScope();
@ -561,7 +561,7 @@ namespace System.Management
OriginalNamespace = string.Empty;
for (int i = 2; i < Len; i++)
{
if (bStart == true)
if (bStart)
{
OriginalNamespace += arrString[i];
}
@ -793,7 +793,7 @@ namespace System.Management
strTemp = strTemp + strToAdd + k.ToString((IFormatProvider)CultureInfo.InvariantCulture.GetFormat(typeof(int)));
}
while (bCollision == true)
while (bCollision)
{
if (IsContainedIn(strTemp, ref PublicProperties) == -1)
{
@ -948,7 +948,7 @@ namespace System.Management
cad.Arguments.Add(caa);
cmp.CustomAttributes.Add(cad);
if (isLiteral == true)
if (isLiteral)
{
cmp.GetStatements.Add(new CodeMethodReturnStatement(new CodeSnippetExpression(propValue.ToString())));
}
@ -1125,7 +1125,7 @@ namespace System.Management
strPropTemp = prop.Name.ToCharArray();
for (i = 0; i < strPropTemp.Length; i++)
{
if (char.IsLetterOrDigit(strPropTemp[i]) == true)
if (char.IsLetterOrDigit(strPropTemp[i]))
{
break;
}
@ -1274,7 +1274,7 @@ namespace System.Management
//Uncomment the line below when that is fixed.
bool isPropertyEnum = GeneratePropertyHelperEnums(prop, PublicProperties[prop.Name].ToString(), bNullable);
if (bRead == true)
if (bRead)
{
if (IsPropertyValueType(prop.Type) && prop.IsArray == false)
{
@ -1445,7 +1445,7 @@ namespace System.Management
}
if (bWrite == true)
if (bWrite)
{
if (bNullable)
{
@ -1481,7 +1481,7 @@ namespace System.Management
}
else
{
if ((isPropertyEnum) && (bNullable == true))
if (isPropertyEnum && bNullable)
{
/*
if (<PropertyName>Values.NULL_ENUM_VALUE == value)
@ -1622,7 +1622,7 @@ namespace System.Management
else if (string.Equals(q.Name, "write", StringComparison.OrdinalIgnoreCase))
{
hasWrite = true;
if ((bool)q.Value == true)
if ((bool)q.Value)
{
writeValue = true;
}
@ -1639,7 +1639,7 @@ namespace System.Management
{
ValueMap.Clear();
//Now check whether the type of the property is int
if (isTypeInt(prop.Type) == true)
if (isTypeInt(prop.Type))
{
if (q.Value != null)
{
@ -1674,7 +1674,7 @@ namespace System.Management
try
{
Values.Clear();
if (isTypeInt(prop.Type) == true)
if (isTypeInt(prop.Type))
{
if (q.Value != null)
{
@ -1707,7 +1707,7 @@ namespace System.Management
try
{
BitMap.Clear();
if (isTypeInt(prop.Type) == true)
if (isTypeInt(prop.Type))
{
if (q.Value != null)
{
@ -1736,7 +1736,7 @@ namespace System.Management
try
{
BitValues.Clear();
if (isTypeInt(prop.Type) == true)
if (isTypeInt(prop.Type))
{
if (q.Value != null)
{
@ -1861,7 +1861,7 @@ namespace System.Management
// If there is no 0 valued field in enum, just add a invalid for enum
// This is just to show in property browser
if ((bNullable == true) && (bZeroFieldInEnum == false))
if (bNullable && !bZeroFieldInEnum)
{
// use the 0 enum position for NULL
cmf = new CodeMemberField();
@ -1870,7 +1870,7 @@ namespace System.Management
EnumObj.Members.Add(cmf);
prop.NullEnumValue = 0;
}
else if ((bNullable == true) && (bZeroFieldInEnum == true))
else if (bNullable && bZeroFieldInEnum)
{
// must create an entry for NULL that is not zero and is not used
// use the another unused enum position for NULL
@ -1880,7 +1880,7 @@ namespace System.Management
EnumObj.Members.Add(cmf);
prop.NullEnumValue = (int)(maxValue + 1);
}
else if ((bNullable == false) && (bZeroFieldInEnum == false))
else if (!bNullable && !bZeroFieldInEnum)
{
// add an entry for 0 valued enum
cmf = new CodeMemberField();
@ -1967,7 +1967,7 @@ namespace System.Management
// If there is no 0 valued field in enum, just add a invalid for enum
// This is just to show in property browser
if ((bNullable == true) && (bZeroFieldInEnum == false))
if (bNullable && !bZeroFieldInEnum)
{
// use the 0 enum position for NULL
cmf = new CodeMemberField();
@ -1976,7 +1976,7 @@ namespace System.Management
EnumObj.Members.Add(cmf);
prop.NullEnumValue = 0;
}
else if ((bNullable == true) && (bZeroFieldInEnum == true))
else if (bNullable && bZeroFieldInEnum)
{
// must create an entry for NULL that is not zero and is not used
// use the another unused enum position for NULL
@ -1996,7 +1996,7 @@ namespace System.Management
prop.NullEnumValue = (int)(maxBitValue);
}
else if ((bNullable == false) && (bZeroFieldInEnum == false))
else if (!bNullable && !bZeroFieldInEnum)
{
// add an entry for 0 valued enum
cmf = new CodeMemberField();
@ -2046,7 +2046,7 @@ namespace System.Management
}
string strPath = OriginalNamespace + ":" + OriginalClassName;
if (bSingletonClass == true)
if (bSingletonClass)
{
strPath += "=@";
cmm.Statements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression(strPath)));
@ -2107,7 +2107,7 @@ namespace System.Management
cmieInit.Parameters.Add(new CodePrimitiveExpression(null));
//If it is a singleton class, then we will make the default constructor to point to the
//only object available
if (bSingletonClass == true)
if (bSingletonClass)
{
cmie = new CodeMethodInvokeExpression();
cmie.Method.TargetObject = new CodeTypeReferenceExpression(PrivateNamesUsed["GeneratedClassName"].ToString());
@ -2722,7 +2722,7 @@ namespace System.Management
new CodeVariableReferenceExpression(PrivateNamesUsed["LateBoundObject"].ToString())));
cc.Members.Add(cmmInit);
// Enable the privileges if the class has privileges qualifier
if (bPrivileges == true)
if (bPrivileges)
{
//Generate the statement
// Boolean bPriveleges = PrivateLateBoundObject.Scope.Options.EnablePrivileges;
@ -2853,7 +2853,7 @@ namespace System.Management
strInParams, new CodePrimitiveExpression(null)));
if (bStatic == true)
if (bStatic)
{
string strPath = "mgmtPath";
CodeObjectCreateExpression cocePath = new CodeObjectCreateExpression();
@ -2874,7 +2874,7 @@ namespace System.Management
strTemp = strClassObj;
}
if (bPrivileges == true)
if (bPrivileges)
{
//Generate the statement
// Boolean bPriveleges = PrivateLateBoundObject.Scope.Options.EnablePrivileges;
@ -2901,7 +2901,7 @@ namespace System.Management
foreach (PropertyData prop in meth.InParameters.Properties)
{
bIsCimDateTimeInterval = false;
if (bfirst == true)
if (bfirst)
{
//Now Generate the statement
// inParams = privObject.GetMethodParameters(<MethodName>);
@ -2999,7 +2999,7 @@ namespace System.Management
foreach (PropertyData prop in meth.OutParameters.Properties)
{
bIsCimDateTimeInterval = false;
if (bfirst == true)
if (bfirst)
{
//Now generate the statement
// ManagementBaseObject outParams = privObject.InvokeMethod(<methodName>,inParams,options);
@ -3023,7 +3023,7 @@ namespace System.Management
bInOut = true;
}
}
if (bInOut == true)
if (bInOut)
continue;
if (string.Equals(prop.Name, "ReturnValue", StringComparison.OrdinalIgnoreCase))
@ -3177,13 +3177,13 @@ namespace System.Management
inoutParams.Clear();
// Assign the privileges back
if (bPrivileges == true)
if (bPrivileges)
{
cis.TrueStatements.Add(new CodeAssignStatement(cprePriveleges, new CodeVariableReferenceExpression(PrivateNamesUsed["Privileges"].ToString())));
}
//Now check if there is a return value. If there is one then return it from the function
if (bRetVal == true)
if (bRetVal)
{
CodeVariableDeclarationStatement cRetVal = new CodeVariableDeclarationStatement(retRefType, "retVar");
cpre = new CodePropertyReferenceExpression(new CodeVariableReferenceExpression(strOutParams), "Properties");
@ -3699,12 +3699,12 @@ namespace System.Management
cf = new CodeMemberField();
cf.Name = memberName;
cf.Attributes = MemberAttributes.Private | MemberAttributes.Final;
if (isStatic == true)
if (isStatic)
{
cf.Attributes |= MemberAttributes.Static;
}
cf.Type = new CodeTypeReference(MemberType);
if (initExpression != null && isStatic == true)
if (initExpression != null && isStatic)
{
cf.InitExpression = initExpression;
}
@ -4758,7 +4758,7 @@ namespace System.Management
strToAdd = new string(arrString[i], 1);
}
if (bAdd == true)
if (bAdd)
{
strRet = string.Concat(strRet, strToAdd);
}
@ -4781,11 +4781,11 @@ namespace System.Management
{
strToAdd = arrIn[i].ToString();
strToAdd = ResolveCollision(strToAdd, true);
if (true == IsContainedInArray(strToAdd, arrayOut))
if (IsContainedInArray(strToAdd, arrayOut))
{
nCurIndex = 0;
strToAdd = arrIn[i].ToString() + nCurIndex.ToString(formatProv);
while (true == IsContainedInArray(strToAdd, arrayOut))
while (IsContainedInArray(strToAdd, arrayOut))
{
nCurIndex++;
strToAdd = arrIn[i].ToString() + nCurIndex.ToString(formatProv);
@ -4895,7 +4895,7 @@ namespace System.Management
throw new ArgumentOutOfRangeException(SR.Format(SR.UnableToCreateCodeGeneratorException, strProvider));
}
if (bSucceeded == true)
if (bSucceeded)
{
GetUnsignedSupport(lang);
}
@ -5665,7 +5665,7 @@ namespace System.Management
CodePropertyReferenceExpression LenProp = null;
if (bIsValueProprequired == true)
if (bIsValueProprequired)
{
LenProp = new CodePropertyReferenceExpression(
new CodeCastExpression(
@ -5734,7 +5734,7 @@ namespace System.Management
CodeMethodInvokeExpression cmie1 = new CodeMethodInvokeExpression();
cmie1.Method.MethodName = "GetValue";
if (bIsValueProprequired == true)
if (bIsValueProprequired)
{
cmie1.Method.TargetObject = new CodeCastExpression(new CodeTypeReference("System.Array"), new CodePropertyReferenceExpression(prop, "Value"));
}

View file

@ -341,7 +341,7 @@ namespace System.Net.Http
lock (SyncObj)
{
bool removed = _activeRequests.Remove(stream);
Debug.Assert(removed == true);
Debug.Assert(removed);
if (ShuttingDown)
{

View file

@ -828,7 +828,7 @@ namespace System.Net.Http
private async ValueTask<Http3Connection> GetHttp3ConnectionAsync(HttpRequestMessage request, HttpAuthority authority, CancellationToken cancellationToken)
{
Debug.Assert(_kind == HttpConnectionKind.Https);
Debug.Assert(_http3Enabled == true);
Debug.Assert(_http3Enabled);
Http3Connection? http3Connection = Volatile.Read(ref _http3Connection);

View file

@ -200,7 +200,7 @@ namespace System.Net
}
set
{
if (value == true)
if (value)
{
m_expires = DateTime.Now;
}
@ -392,7 +392,7 @@ namespace System.Net
// Check/set domain
//
// If domain is implicit => assume a) uri is valid, b) just set domain to uri hostname.
if (setDefault && m_domain_implicit == true)
if (setDefault && m_domain_implicit)
{
m_domain = host;
}
@ -491,7 +491,7 @@ namespace System.Net
}
// Check/Set Path
if (setDefault && m_path_implicit == true)
if (setDefault && m_path_implicit)
{
// This code assumes that the URI path is always valid and contains at least one '/'.
switch (m_cookieVariant)

View file

@ -63,7 +63,7 @@ namespace System.Net
lock (this)
{
if (_closing == true)
if (_closing)
return;
_closing = true;
_writeable = false;

View file

@ -49,7 +49,7 @@ namespace System.Xml
{
Debug.Assert(name != null && name.Length > 0);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
RawText("<!DOCTYPE ");
@ -102,7 +102,7 @@ namespace System.Xml
{
Debug.Assert(prefix.Length == 0);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_currentElementProperties = TernaryTreeReadOnly.FindElementProperty(localName);
base._bufChars[_bufPos++] = (char)'<';
@ -142,7 +142,7 @@ namespace System.Xml
{
Debug.Assert(prefix.Length == 0);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
if ((_currentElementProperties & ElementProperties.EMPTY) == 0)
{
@ -167,7 +167,7 @@ namespace System.Xml
{
Debug.Assert(prefix.Length == 0);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
if ((_currentElementProperties & ElementProperties.EMPTY) == 0)
{
@ -291,7 +291,7 @@ namespace System.Xml
{
Debug.Assert(prefix.Length == 0);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
if (base._attrEndPos == _bufPos)
{
@ -342,7 +342,7 @@ namespace System.Xml
_endsWithAmpersand = false;
}
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
base._bufChars[_bufPos++] = (char)'"';
}
@ -355,7 +355,7 @@ namespace System.Xml
{
Debug.Assert(target != null && target.Length != 0 && text != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[base._bufPos++] = (char)'<';
_bufChars[base._bufPos++] = (char)'?';
@ -816,7 +816,7 @@ namespace System.Xml
{
Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
base._elementScope.Push((byte)base._currentElementProperties);

View file

@ -214,7 +214,7 @@ namespace System.Xml
// Output xml declaration only if user allows it and it was not already output
if (!_omitXmlDeclaration && !_autoXmlDeclaration)
{
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
RawText("<?xml version=\"");
// Version
@ -252,7 +252,7 @@ namespace System.Xml
{
Debug.Assert(name != null && name.Length > 0);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
RawText("<!DOCTYPE ");
RawText(name);
@ -294,7 +294,7 @@ namespace System.Xml
Debug.Assert(localName != null && localName.Length > 0);
Debug.Assert(prefix != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[_bufPos++] = (char)'<';
if (prefix != null && prefix.Length != 0)
@ -326,7 +326,7 @@ namespace System.Xml
Debug.Assert(localName != null && localName.Length > 0);
Debug.Assert(prefix != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
if (_contentPos != _bufPos)
{
@ -358,7 +358,7 @@ namespace System.Xml
Debug.Assert(localName != null && localName.Length > 0);
Debug.Assert(prefix != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[_bufPos++] = (char)'<';
_bufChars[_bufPos++] = (char)'/';
@ -378,7 +378,7 @@ namespace System.Xml
Debug.Assert(localName != null && localName.Length > 0);
Debug.Assert(prefix != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
if (_attrEndPos == _bufPos)
{
@ -400,7 +400,7 @@ namespace System.Xml
// Serialize the end of an attribute value using double quotes: '"'
public override void WriteEndAttribute()
{
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[_bufPos++] = (char)'"';
_inAttributeValue = false;
@ -428,7 +428,7 @@ namespace System.Xml
{
Debug.Assert(prefix != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
if (prefix.Length == 0)
{
@ -449,7 +449,7 @@ namespace System.Xml
internal override void WriteEndNamespaceDeclaration()
{
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_inAttributeValue = false;
_bufChars[_bufPos++] = (char)'"';
@ -462,7 +462,7 @@ namespace System.Xml
{
Debug.Assert(text != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
if (_mergeCDataSections && _bufPos == _cdataPos)
{
@ -499,7 +499,7 @@ namespace System.Xml
{
Debug.Assert(text != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[_bufPos++] = (char)'<';
_bufChars[_bufPos++] = (char)'!';
@ -519,7 +519,7 @@ namespace System.Xml
Debug.Assert(name != null && name.Length > 0);
Debug.Assert(text != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[_bufPos++] = (char)'<';
_bufChars[_bufPos++] = (char)'?';
@ -540,7 +540,7 @@ namespace System.Xml
{
Debug.Assert(name != null && name.Length > 0);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[_bufPos++] = (char)'&';
RawText(name);
@ -565,7 +565,7 @@ namespace System.Xml
throw XmlConvert.CreateInvalidCharException(ch, '\0');
}
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[_bufPos++] = (char)'&';
_bufChars[_bufPos++] = (char)'#';
@ -587,7 +587,7 @@ namespace System.Xml
{
Debug.Assert(ws != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
fixed (char* pSrc = ws)
{
@ -628,7 +628,7 @@ namespace System.Xml
// Serialize surrogate character entity.
public override void WriteSurrogateCharEntity(char lowChar, char highChar)
{
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
int surrogateChar = XmlCharType.CombineSurrogateChar(lowChar, highChar);
_bufChars[_bufPos++] = (char)'&';
@ -672,7 +672,7 @@ namespace System.Xml
Debug.Assert(index >= 0);
Debug.Assert(count >= 0 && index + count <= buffer.Length);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
fixed (char* pSrcBegin = &buffer[index])
{
@ -688,7 +688,7 @@ namespace System.Xml
{
Debug.Assert(data != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
fixed (char* pSrcBegin = data)
{

View file

@ -37,7 +37,7 @@ namespace System.Xml
// Output xml declaration only if user allows it and it was not already output
if (!_omitXmlDeclaration && !_autoXmlDeclaration)
{
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
await RawTextAsync("<?xml version=\"").ConfigureAwait(false);
// Version
@ -135,7 +135,7 @@ namespace System.Xml
CheckAsyncCall();
Debug.Assert(name != null && name.Length > 0);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
await RawTextAsync("<!DOCTYPE ").ConfigureAwait(false);
await RawTextAsync(name).ConfigureAwait(false);
@ -178,7 +178,7 @@ namespace System.Xml
Debug.Assert(localName != null && localName.Length > 0);
Debug.Assert(prefix != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
Task task;
_bufChars[_bufPos++] = (char)'<';
@ -206,7 +206,7 @@ namespace System.Xml
Debug.Assert(localName != null && localName.Length > 0);
Debug.Assert(prefix != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
if (_contentPos != _bufPos)
{
@ -241,7 +241,7 @@ namespace System.Xml
Debug.Assert(localName != null && localName.Length > 0);
Debug.Assert(prefix != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[_bufPos++] = (char)'<';
_bufChars[_bufPos++] = (char)'/';
@ -263,7 +263,7 @@ namespace System.Xml
Debug.Assert(localName != null && localName.Length > 0);
Debug.Assert(prefix != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
if (_attrEndPos == _bufPos)
{
@ -293,7 +293,7 @@ namespace System.Xml
{
CheckAsyncCall();
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[_bufPos++] = (char)'"';
_inAttributeValue = false;
@ -317,7 +317,7 @@ namespace System.Xml
CheckAsyncCall();
Debug.Assert(prefix != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
if (prefix.Length == 0)
{
@ -340,7 +340,7 @@ namespace System.Xml
{
CheckAsyncCall();
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_inAttributeValue = false;
@ -357,7 +357,7 @@ namespace System.Xml
CheckAsyncCall();
Debug.Assert(text != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
if (_mergeCDataSections && _bufPos == _cdataPos)
{
@ -395,7 +395,7 @@ namespace System.Xml
CheckAsyncCall();
Debug.Assert(text != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[_bufPos++] = (char)'<';
_bufChars[_bufPos++] = (char)'!';
@ -416,7 +416,7 @@ namespace System.Xml
Debug.Assert(name != null && name.Length > 0);
Debug.Assert(text != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[_bufPos++] = (char)'<';
_bufChars[_bufPos++] = (char)'?';
@ -438,7 +438,7 @@ namespace System.Xml
CheckAsyncCall();
Debug.Assert(name != null && name.Length > 0);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[_bufPos++] = (char)'&';
await RawTextAsync(name).ConfigureAwait(false);
@ -464,7 +464,7 @@ namespace System.Xml
throw XmlConvert.CreateInvalidCharException(ch, '\0');
}
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
_bufChars[_bufPos++] = (char)'&';
_bufChars[_bufPos++] = (char)'#';
@ -487,7 +487,7 @@ namespace System.Xml
CheckAsyncCall();
Debug.Assert(ws != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
if (_inAttributeValue)
{
@ -523,7 +523,7 @@ namespace System.Xml
{
CheckAsyncCall();
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
int surrogateChar = XmlCharType.CombineSurrogateChar(lowChar, highChar);
@ -567,7 +567,7 @@ namespace System.Xml
Debug.Assert(index >= 0);
Debug.Assert(count >= 0 && index + count <= buffer.Length);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
await WriteRawWithCharCheckingAsync(buffer, index, count).ConfigureAwait(false);
@ -581,7 +581,7 @@ namespace System.Xml
CheckAsyncCall();
Debug.Assert(data != null);
if (_trackTextContent && _inTextContent != false) { ChangeTextContentMark(false); }
if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); }
await WriteRawWithCharCheckingAsync(data).ConfigureAwait(false);

View file

@ -1478,7 +1478,7 @@ namespace System.Xml
switch (_stack[_top].defaultNsState)
{
case NamespaceState.DeclaredButNotWrittenOut:
Debug.Assert(declared == true, "Unexpected situation!!");
Debug.Assert(declared, "Unexpected situation!!");
// the first namespace that the user gave us is what we
// like to keep.
break;

View file

@ -206,7 +206,7 @@ namespace System.Xml
//the function is for the enumerator to find out the next available matching element node
public XmlNode? GetNextNode(XmlNode? n)
{
if (_empty == true)
if (_empty)
return null;
XmlNode node = n ?? _rootNode;
return GetMatchingNode(node, true);
@ -217,7 +217,7 @@ namespace System.Xml
if (_rootNode == null || index < 0)
return null;
if (_empty == true)
if (_empty)
return null;
if (_curInd == index)
return _curElem;
@ -241,7 +241,7 @@ namespace System.Xml
{
get
{
if (_empty == true)
if (_empty)
return 0;
if (_matchCount < 0)
@ -268,7 +268,7 @@ namespace System.Xml
public override IEnumerator GetEnumerator()
{
if (_empty == true)
if (_empty)
return new XmlEmptyElementListEnumerator(this);
return new XmlElementListEnumerator(this);

View file

@ -152,7 +152,7 @@ namespace System.Xml.Schema
internal void CompilePatternFacet(XmlSchemaPatternFacet facet)
{
CheckProhibitedFlag(facet, RestrictionFlags.Pattern, SR.Sch_PatternFacetProhibited);
if (_firstPattern == true)
if (_firstPattern)
{
_regStr = new StringBuilder();
_regStr.Append('(');

View file

@ -804,14 +804,14 @@ namespace System.Xml.Serialization
WriteAttribute(@"id", @"", ((string?)o.@Id));
WriteAttribute(@"name", @"", ((string?)o.@Name));
WriteAttribute(@"final", @"", Write11_XmlSchemaDerivationMethod(o.FinalResolved));
if (((bool)o.@IsAbstract) != false)
if ((bool)o.@IsAbstract)
{
WriteAttribute(@"abstract", @"", XmlConvert.ToString((bool)((bool)o.@IsAbstract)));
WriteAttribute(@"abstract", @"", XmlConvert.ToString((bool)(bool)o.@IsAbstract));
}
WriteAttribute(@"block", @"", Write11_XmlSchemaDerivationMethod(o.BlockResolved));
if (((bool)o.@IsMixed) != false)
if ((bool)o.@IsMixed)
{
WriteAttribute(@"mixed", @"", XmlConvert.ToString((bool)((bool)o.@IsMixed)));
WriteAttribute(@"mixed", @"", XmlConvert.ToString((bool)(bool)o.@IsMixed));
}
WriteAttributes((XmlAttribute[]?)o.@UnhandledAttributes, o);
Write5_XmlSchemaAnnotation((XmlSchemaAnnotation?)o.@Annotation);
@ -972,9 +972,9 @@ namespace System.Xml.Serialization
WriteAttribute(@"id", @"", o.Id);
WriteAttribute("minOccurs", "", XmlConvert.ToString(o.MinOccurs));
WriteAttribute("maxOccurs", "", o.MaxOccurs == decimal.MaxValue ? "unbounded" : XmlConvert.ToString(o.MaxOccurs));
if (((bool)o.@IsAbstract) != false)
if ((bool)o.@IsAbstract)
{
WriteAttribute(@"abstract", @"", XmlConvert.ToString((bool)((bool)o.@IsAbstract)));
WriteAttribute(@"abstract", @"", XmlConvert.ToString((bool)(bool)o.@IsAbstract));
}
WriteAttribute(@"block", @"", Write11_XmlSchemaDerivationMethod(o.BlockResolved));
WriteAttribute(@"default", @"", o.DefaultValue);

View file

@ -906,7 +906,7 @@ namespace System.Xml.Xsl
set
{
Debug.Assert(index1 < _bits.Length && index2 < _bits.Length, "Index out of range.");
if (value == true)
if (value)
{
_bits[index1] |= (ulong)1 << index2;
}

View file

@ -211,7 +211,7 @@ namespace System.Xml.Xsl.XsltOld
PopElementScope();
_popScope = (state & StateMachine.PopScope) != 0;
if ((state & StateMachine.EmptyTag) != 0 && _mainNode.IsEmptyTag == true)
if ((state & StateMachine.EmptyTag) != 0 && _mainNode.IsEmptyTag)
{
return Processor.OutputResult.Continue;
}

View file

@ -229,7 +229,7 @@ namespace System.Xml.Xsl.XsltOld
private void WriteDoctype(BuilderInfo mainNode)
{
Debug.Assert(_outputDoctype == true, "It supposed to check this condition before actual call");
Debug.Assert(_outputDoctype, "It supposed to check this condition before actual call");
Debug.Assert(_output.DoctypeSystem != null || (_isHtmlOutput && _output.DoctypePublic != null), "We set outputDoctype == true only if");
Indent(0);
Write(s_DocType);
@ -264,7 +264,7 @@ namespace System.Xml.Xsl.XsltOld
private void WriteXmlDeclaration()
{
Debug.Assert(_outputXmlDecl == true, "It supposed to check this condition before actual call");
Debug.Assert(_outputXmlDecl, "It supposed to check this condition before actual call");
Debug.Assert(_isXmlOutput && !_output.OmitXmlDeclaration, "We set outputXmlDecl == true only if");
_outputXmlDecl = false;

View file

@ -421,7 +421,7 @@ namespace System
}
else
{
return (param1Less == true) ? 1 : 2;
return param1Less ? 1 : 2;
}
}

View file

@ -1237,7 +1237,7 @@ namespace System.Security.AccessControl
continue;
}
if (true == MergeAces(ref thisAce, nextAce))
if (MergeAces(ref thisAce, nextAce))
{
_acl.RemoveAce(i + 1);
}
@ -1630,7 +1630,7 @@ namespace System.Security.AccessControl
if ((ObjectTypesMatch(ace, newAce)) &&
(AceFlagsAreMergeable(ace, newAce)))
{
if (true == MergeInheritanceBits(ace.AceFlags, newAce.AceFlags, IsDS, out merged))
if (MergeInheritanceBits(ace.AceFlags, newAce.AceFlags, IsDS, out merged))
{
ace.AceFlags = (merged | (ace.AceFlags & AceFlags.AuditFlags));
return true;
@ -1639,7 +1639,7 @@ namespace System.Security.AccessControl
}
else
{
if (true == MergeInheritanceBits(ace.AceFlags, newAce.AceFlags, IsDS, out merged))
if (MergeInheritanceBits(ace.AceFlags, newAce.AceFlags, IsDS, out merged))
{
ace.AceFlags = (merged | (ace.AceFlags & AceFlags.AuditFlags));
return true;
@ -1881,7 +1881,7 @@ namespace System.Security.AccessControl
// Avoid inserting meaningless ACEs
//
if (true == InspectAce(ref ace, isDacl))
if (InspectAce(ref ace, isDacl))
{
_acl.InsertAce(_acl.Count, ace);
}
@ -1892,7 +1892,7 @@ namespace System.Security.AccessControl
// See whether the ACL is canonical to begin with
//
if (true == CanonicalCheck(isDacl))
if (CanonicalCheck(isDacl))
{
//
// Sort and compact the array
@ -2024,7 +2024,7 @@ namespace System.Security.AccessControl
continue;
}
if (true == MergeAces(ref ace, (QualifiedAce)newAce))
if (MergeAces(ref ace, (QualifiedAce)newAce))
{
aceMerged = true;
break;

View file

@ -201,7 +201,7 @@ namespace System.Security.AccessControl
if (error != 0)
{
if (success == true)
if (success)
{
this.threadHandle = threadHandleBefore;
@ -212,7 +212,7 @@ namespace System.Security.AccessControl
System.Diagnostics.Debug.Assert(this.isImpersonating == false, "Incorrect isImpersonating state");
if (success == true)
if (success)
{
error = 0;
if (false == Interop.Advapi32.DuplicateTokenEx(
@ -228,7 +228,7 @@ namespace System.Security.AccessControl
}
}
if (success == true)
if (success)
{
error = SetThreadToken(this.threadHandle);
unchecked { error &= ~(int)0x80070000; }
@ -239,7 +239,7 @@ namespace System.Security.AccessControl
}
}
if (success == true)
if (success)
{
this.isImpersonating = true;
}

View file

@ -82,7 +82,7 @@ namespace System.Security.Cryptography.Cose
CoseHeaderMap? unprotectedHeaders,
bool isDetached)
{
Debug.Assert(contentStream == null || (isDetached == true && contentBytes.Length == 0));
Debug.Assert(contentStream == null || (isDetached && contentBytes.Length == 0));
ValidateBeforeSign(protectedHeaders, unprotectedHeaders, keyType, hashAlgorithm, out int? algHeaderValueToSlip);

View file

@ -172,7 +172,7 @@ namespace System.Security.Cryptography.Xml
XmlNode node = ((IHasXmlNode)it.Current).GetNode();
bool include = (bool)it.Current.Evaluate(xpathExpr);
if (include == true)
if (include)
resultNodeList.Add(node);
}

View file

@ -63,7 +63,7 @@ namespace System.Speech.Internal.ObjectTokens
{
if (disposing)
{
if (_disposeSapiObjectToken == true && _sapiObjectToken != null)
if (_disposeSapiObjectToken && _sapiObjectToken != null)
{
Marshal.ReleaseComObject(_sapiObjectToken);
_sapiObjectToken = null;

View file

@ -579,7 +579,7 @@ namespace System.Speech.Internal.SrgsCompiler
if (arc.RuleRef.Name.IndexOf("URL:DYNAMIC#", StringComparison.Ordinal) == 0)
{
ruleName = arc.RuleRef.Name.Substring(12);
if (fromOrg == true && FindInRules(ruleName) == null)
if (fromOrg && FindInRules(ruleName) == null)
{
Rule ruleExtra = extra.FindInRules(ruleName);
if (ruleExtra == null)

View file

@ -104,8 +104,7 @@ namespace System.Text
fallbackBuffer.MovePrevious(); // don't use last fallback
else
{
Debug.Assert(_chars > _charStart ||
((bThrow == true) && (_bytes == _byteStart)),
Debug.Assert(_chars > _charStart || (bThrow && (_bytes == _byteStart)),
"[EncodingByteBuffer.MovePrevious]expected previous data or throw");
if (_chars > _charStart)
_chars--; // don't use last char

View file

@ -1031,7 +1031,7 @@ namespace System.Text
// escape, so use 0x8e00 as katakana lead byte and keep same trail byte.
// 0x2a lead byte range is normally unused in JIS 0208, so shouldn't have
// any weird compatibility issues.
if ((b2Bytes == true) && ((iBytes & 0xff00) == 0x2a00))
if (b2Bytes && ((iBytes & 0xff00) == 0x2a00))
{
iBytes = (ushort)(iBytes & 0xff);
iBytes |= (LEADBYTE_HALFWIDTH << 8); // Put us in the halfwidth katakana range

View file

@ -1010,7 +1010,7 @@ namespace System.Threading.Tasks
int nToExclusiveLocal;
if (currentWorker.FindNewWork32(out nFromInclusiveLocal, out nToExclusiveLocal) == false ||
sharedPStateFlags.ShouldExitLoop(nFromInclusiveLocal) == true)
sharedPStateFlags.ShouldExitLoop(nFromInclusiveLocal))
{
return; // no need to run
}
@ -1272,7 +1272,7 @@ namespace System.Threading.Tasks
long nToExclusiveLocal;
if (currentWorker.FindNewWork(out nFromInclusiveLocal, out nToExclusiveLocal) == false ||
sharedPStateFlags.ShouldExitLoop(nFromInclusiveLocal) == true)
sharedPStateFlags.ShouldExitLoop(nFromInclusiveLocal))
{
return; // no need to run
}

View file

@ -330,10 +330,9 @@ namespace System
#endregion
#region Filter by name wrt prefixLookup and implicitly by case sensitivity
if (prefixLookup == true)
if (prefixLookup && !FilterApplyPrefixLookup(memberInfo, name, (bindingFlags & BindingFlags.IgnoreCase) != 0))
{
if (!FilterApplyPrefixLookup(memberInfo, name, (bindingFlags & BindingFlags.IgnoreCase) != 0))
return false;
return false;
}
#endregion
@ -929,7 +928,7 @@ namespace System
if (ReferenceEquals(fieldInfo.DeclaringType, match.DeclaringType))
throw new AmbiguousMatchException();
if ((match.DeclaringType!.IsInterface == true) && (fieldInfo.DeclaringType!.IsInterface == true))
if (match.DeclaringType!.IsInterface && fieldInfo.DeclaringType!.IsInterface)
multipleStaticFieldMatches = true;
}

View file

@ -509,8 +509,8 @@ namespace Microsoft.WebAssembly.Diagnostics
var loc = SourceLocation.Parse(args?["location"] as JObject);
if (loc == null)
return false;
var ret = await OnSetNextIP(id, loc, token);
if (ret == true)
bool ret = await OnSetNextIP(id, loc, token);
if (ret)
SendResponse(id, Result.OkFromObject(new { }), token);
else
SendResponse(id, Result.Err("Set next instruction pointer failed."), token);