V3004. The 'then' statement is equivalent to the 'else' statement.
V3004 The 'then' statement is equivalent to the 'else' statement. TinyMCE.cs 170
public TinyMCE(IData Data, string Configuration)
{
....
if (p.Alias.StartsWith("."))
styles += p.Text + "=" + p.Alias;
else
styles += p.Text + "=" + p.Alias;
....
}
V3004 The 'then' statement is equivalent to the 'else' statement. Editor.cs 225
new public bool Enabled {
get { return base.Enabled; }
set {
if (this.InvokeRequired) {
base.Enabled = this.VScrollBar.Enabled =
this.hexView.Enabled =this.textView.Enabled =
this.side.Enabled = this.header.Enabled = value;
} else {
base.Enabled = this.VScrollBar.Enabled =
this.hexView.Enabled = this.textView.Enabled =
this.side.Enabled = this.header.Enabled = value;
}
}
}
V3004 The 'then' statement is equivalent to the 'else' statement. Metadata.cs 2602
private void SerializeFieldRvaTable(....)
{
....
switch (row.TargetSection){
case PESection.SData:
case PESection.TLS:
Fixup fixup = new Fixup();
fixup.fixupLocation = writer.BaseStream.Position;
fixup.addressOfNextInstruction = row.RVA;
if (row.TargetSection == PESection.SData){
sdataFixup.nextFixUp = fixup; // <=
sdataFixup = fixup; // <=
}else{
sdataFixup.nextFixUp = fixup; // <=
sdataFixup = fixup; // <=
}
writer.Write((int)0);
break;
....
}
Similar errors can be found in some other places:
V3004 The 'then' statement is equivalent to the 'else' statement. XmlSerializationWriterILGen.cs 1213
private void WriteMember(...., TypeDesc memberTypeDesc, ....)
{
....
if (memberTypeDesc.IsArray)
{
LocalBuilder localI = ilg.DeclareOrGetLocal(...., iVar);
ilg.For(localI, 0, ilg.GetLocal(aVar));
}
else
{
LocalBuilder localI = ilg.DeclareOrGetLocal(...., iVar);
ilg.For(localI, 0, ilg.GetLocal(aVar));
}
....
}
V3004 The 'then' statement is equivalent to the 'else' statement. SqlUtil.cs 93
internal static void ContinueTask(....)
{
....
if (connectionToDoom != null || connectionToAbort != null)
{
try
{
onSuccess();
}
catch (Exception e)
{
completion.SetException(e);
}
}
else
{ // no connection to doom - reliability section not required
try
{
onSuccess();
}
catch (Exception e)
{
completion.SetException(e);
}
}
....
}
V3004 The 'then' statement is equivalent to the 'else' statement. GetSemanticInfoTests.cs 2269
public void IndexerMemberRace()
{
....
for (int i = 0; i < 20; i++)
{
....
if (i % 2 == 0)
{
thread1.Start();
thread2.Start();
}
else
{
thread1.Start();
thread2.Start();
}
....
}
....
}
V3004 The 'then' statement is equivalent to the 'else' statement. Atf.Gui.WinForms.vs2010 DropDescriptionHelper.cs 199
public static void DefaultGiveFeedback(IComDataObject data,
GiveFeedbackEventArgs e)
{
....
if (setDefaultDropDesc &&
(DropImageType)e.Effect != currentType)
{
if (e.Effect != DragDropEffects.None)
{
SetDropDescription(data,
(DropImageType)e.Effect, e.Effect.ToString(), null);
}
else
{
SetDropDescription(data,
(DropImageType)e.Effect, e.Effect.ToString(), null);
}
....
}
}
V3004 The 'then' statement is equivalent to the 'else' statement. Sandbox.Game MyAgentBot.cs 260
private void StartRespawn()
{
m_lastCountdownTime = MySandboxGame
.TotalGamePlayTimeInMilliseconds;
if (m_removeAfterDeath)
m_deathCountdownMs = AgentDefinition.RemoveTimeMs;
else
m_deathCountdownMs = AgentDefinition.RemoveTimeMs;
}
V3004 The 'then' statement is equivalent to the 'else' statement. Sandbox.Game MyNavigationTriangle.cs 189
private static bool IsTriangleDangerous(int triIndex)
{
if (MyPerGameSettings.NavmeshPresumesDownwardGravity)
{
return triIndex == -1;
}
else
{
return triIndex == -1;
}
}
V3004 The 'then' statement is equivalent to the 'else' statement. Sandbox.Game MyThrust.cs 149
public void UpdateLight()
{
....
if (((MyCubeGrid)Parent).GridSizeEnum == MyCubeSize.Large)
Light.GlareIntensity = 0.5f + length * 2;
else
Light.GlareIntensity = 0.5f + length * 2;
....
}
V3004 The 'then' statement is equivalent to the 'else' statement. System.Windows.Forms-net_4_x TextBoxTextRenderer.cs 79
public static void DrawText (....)
{
....
if (showNonPrint)
TextRenderer.DrawTextInternal (g, text, font,
new Rectangle (new Point ((int)x, (int)y), max_size),
color,
TextFormatFlags.NoPadding |
TextFormatFlags.NoPrefix, false);
else
TextRenderer.DrawTextInternal (g, text, font,
new Rectangle (new Point ((int)x, (int)y), max_size),
color,
TextFormatFlags.NoPadding |
TextFormatFlags.NoPrefix, false);
....
}
V3004 The 'then' statement is equivalent to the 'else' statement. VisualPascalABCNET CodeCompletionWindow.cs 204
public void HandleMouseWheel(....)
{
....
if (System.Windows.Forms.SystemInformation.
MouseWheelScrollLines > 0) {
newValue = this.vScrollBar.Value -
(control.TextEditorProperties.MouseWheelScrollDown ? 1 :
-1) * multiplier;
} else {
newValue = this.vScrollBar.Value -
(control.TextEditorProperties.MouseWheelScrollDown ? 1 :
-1) * multiplier;
}
....
}
Similar errors can be found in some other places:
V3004 The 'then' statement is equivalent to the 'else' statement. Runtime RegexpTreeBuilder.cs 1080
public int Compare(Pair<int, int> x, Pair<int, int> y)
{
if (x.First < y.First)
{
if (x.Second >= y.Second)
{
return 1;
}
else
{
return 1;
}
}
else if (x.First > y.First)
{
if (x.Second <= y.Second)
{
return -1;
}
else
{
return -1;
}
}
....
}
Similar errors can be found in some other places:
V3004 The 'then' statement is equivalent to the 'else' statement. HtmlTextRenderer.cs 2092
public override Run Split(float availableWidth, out Run secondPart)
{
....
if (r.Width > availableWidth)
{
List<CharWithIndex> list = new List<CharWithIndex>();
for (int i = point; i < size; i++)
list.Add(chars[i]);
secondPart = new RunText(renderer, word, style, list,
left + r.Width, charIndex);
list.Clear();
for (int i = 0; i < point; i++)
list.Add(chars[i]);
r = new RunText(renderer, word, style, list, left, charIndex);
return r;
}
else
{
List<CharWithIndex> list = new List<CharWithIndex>();
for (int i = point; i < size; i++)
list.Add(chars[i]);
secondPart = new RunText(renderer, word, style, list,
left + r.Width, charIndex);
list.Clear();
for (int i = 0; i < point; i++)
list.Add(chars[i]);
r = new RunText(renderer, word, style, list, left, charIndex);
return r;
}
....
}
V3004 The 'then' statement is equivalent to the 'else' statement. DirectorySearcher.cs 629
private SearchResultCollection FindAll(bool findMoreThanOne)
{
searchResult = null;
DirectoryEntry clonedRoot = null;
if (_assertDefaultNamingContext == null)
{
clonedRoot = SearchRoot.CloneBrowsable();
}
else
{
clonedRoot = SearchRoot.CloneBrowsable();
}
....
}
V3004 The 'then' statement is equivalent to the 'else' statement. QueryOutputWriterV1.cs 242
public override void WriteBase64(byte[] buffer, int index, int count)
{
if (!_inAttr && (_inCDataSection || StartCDataSection()))
_wrapped.WriteBase64(buffer, index, count);
else
_wrapped.WriteBase64(buffer, index, count);
}
V3004 The 'then' statement is equivalent to the 'else' statement. DataGridSortDescription.cs 235
public override
IOrderedEnumerable<object> ThenBy(IOrderedEnumerable<object> seq)
{
if (_descending)
{
return seq.ThenByDescending(o => GetValue(o), InternalComparer);
}
else
{
return seq.ThenByDescending(o => GetValue(o), InternalComparer);
}
}
V3004 The 'then' statement is equivalent to the 'else' statement. SqliteItemRepository.cs 5648
private QueryResult<Tuple<BaseItem, ItemCounts>> GetItemValues(....)
{
....
if (typesToCount.Length == 0)
{
whereText += " And CleanName In (Select CleanValue
from ItemValues where "
+ typeClause + " AND ItemId in (select guid from TypedBaseItems"
+ innerWhereText + "))";
}
else
{
//whereText += " And itemTypes not null";
whereText += " And CleanName In (Select CleanValue
from ItemValues where "
+ typeClause + " AND ItemId in (select guid from TypedBaseItems"
+ innerWhereText + "))";
}
....
}
V3004 The 'then' statement is equivalent to the 'else' statement. Serialization.cs 1571
public override void WriteDeltaTime( DateTime value )
{
....
try
{
d = new TimeSpan( ticks-now );
}
catch
{
if( ticks < now )
d = TimeSpan.MaxValue;
else
d = TimeSpan.MaxValue;
}
....
}
Similar errors can be found in some other places:
V3004 The 'then' statement is equivalent to the 'else' statement. Nethermind.BeaconNode BeaconNodeFacade.cs 177
public async Task<ApiResponse>
PublishBlockAsync(SignedBeaconBlock signedBlock,
CancellationToken cancellationToken)
{
bool acceptedLocally = false;
....
if (acceptedLocally)
{
return new ApiResponse(StatusCode.Success);
}
else
{
return new ApiResponse(StatusCode.Success);
}
....
}
Similar errors can be found in some other places:
V3004 The 'then' statement is equivalent to the 'else' statement. FuturesExpiryFunctions.cs 1561
public static readonly Dictionary<....>
FuturesExpiryDictionary = new Dictionary<....>()
{
....
if (twoMonthsPriorToContractMonth.Month == 2)
{
lastBusinessDay = FuturesExpiryUtilityFunctions
.NthLastBusinessDay(twoMonthsPriorToContractMonth, 1);
}
else
{
lastBusinessDay = FuturesExpiryUtilityFunctions
.NthLastBusinessDay(twoMonthsPriorToContractMonth, 1);
}
....
}
V3004 The 'then' statement is equivalent to the 'else' statement. SelectelStorage.cs 461
public override string[] ListFilesRelative(....)
{
var paths = new List<String>();
var client = GetClient().Result;
if (recursive)
{
paths = client.GetContainerFilesAsync(_private_container, int.MaxValue,
null, MakePath(domain, path)).Result.Select(x => x.Name).ToList();
}
else
{
paths = client.GetContainerFilesAsync(_private_container, int.MaxValue,
null, MakePath(domain, path)).Result.Select(x => x.Name).ToList();
}
....
}