Repository: dotnet/runtime
File: src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Utils.cs (C#)

Code before:
                                            }
                                        }
                                    }
                                    else
                                    {
                                        propertyName = propertyWithRangeInfo2;
                                    }

                                    if (propertyName == null)
                                    {
                                        // property does not exist, possiblyno values, so continue
                                        continue;
                                    }

                                    bool foundPartitionEntry = false;
                                    int valueCount = 0;

                                    foreach (string dnString in res.Properties[propertyName])
                                    {
                                        Debug.Assert(dnString.Length > 10, "ConfigurationSet::GetReplicaList - dnWithBinary is not in the expected format.");

                                        if (((dnString.Length - 13) >= partitionName!.Length) && (Utils.Compare(dnString, 13, partitionName.Length, partitionName, 0, partitionName.Length) == 0))
                                        {
                                            foundPartitionEntry = true;

                                            if (dnString.AsSpan(10, 1).Equals("0", StringComparison.OrdinalIgnoreCase))
                                            {
                                                ntdsaNames.Add(ntdsaName);
                                                if (isADAM)
                                                {
                                                    serverPorts.Add(ntdsaName, (int)PropertyManager.GetSearchResultPropertyValue(res, PropertyManager.MsDSPortLDAP)!);
                                                }
                                                break;
                                            }
                                        }

                                        valueCount++;
                                    }

                                    if ((!foundPartitionEntry) && ((propertyName.Length >= propertyWithRangeInfo2.Length) && (Utils.Compare(propertyName, 0, propertyWithRangeInfo2.Length, propertyWithRangeInfo2, 0, propertyWithRangeInfo2.Length) != 0)))
                                    {
                                        needToContinueRangeRetrieval = true;
                                        ntdsaNamesForRangeRetrieval.Add(ntdsaName);
                                        rangeStart += valueCount;
                                    }
                                }
                            }
                            finally
                            {
                                resCol2.Dispose();
                            }

Review comment (suggestion):
```suggestion
                                            if (dnString[10] == '0')
```

Code after:
                                            }
                                        }
                                    }
                                    else
                                    {
                                        propertyName = propertyWithRangeInfo2;
                                    }

                                    if (propertyName == null)
                                    {
                                        // property does not exist, possiblyno values, so continue
                                        continue;
                                    }

                                    bool foundPartitionEntry = false;
                                    int valueCount = 0;

                                    foreach (string dnString in res.Properties[propertyName])
                                    {
                                        Debug.Assert(dnString.Length > 10, "ConfigurationSet::GetReplicaList - dnWithBinary is not in the expected format.");

                                        if (((dnString.Length - 13) >= partitionName!.Length) && (Utils.Compare(dnString, 13, partitionName.Length, partitionName, 0, partitionName.Length) == 0))
                                        {
                                            foundPartitionEntry = true;

                                            if (dnString[10] == '0')
                                            {
                                                ntdsaNames.Add(ntdsaName);
                                                if (isADAM)
                                                {
                                                    serverPorts.Add(ntdsaName, (int)PropertyManager.GetSearchResultPropertyValue(res, PropertyManager.MsDSPortLDAP)!);
                                                }
                                                break;
                                            }
                                        }

                                        valueCount++;
                                    }

                                    if ((!foundPartitionEntry) && ((propertyName.Length >= propertyWithRangeInfo2.Length) && (Utils.Compare(propertyName, 0, propertyWithRangeInfo2.Length, propertyWithRangeInfo2, 0, propertyWithRangeInfo2.Length) != 0)))
                                    {
                                        needToContinueRangeRetrieval = true;
                                        ntdsaNamesForRangeRetrieval.Add(ntdsaName);
                                        rangeStart += valueCount;
                                    }
                                }
                            }
                            finally
                            {
                                resCol2.Dispose();
                            }