|
Outside of that...
Who knows the context, but I'm going to guess that filters is a private member property, and Filtering is exposed.
Why wouldn't someone just make Filtering a public, get-only convenience property then, rather than setting some piece of data, where we now have to maintain two things?
|
|
|
|
|
|
I challenge you to code me a rotating potato. This is a serious challenge, are you up to the task?
|
|
|
|
|
Seriously, we only do broccoli here.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
My potatoes do not rotate. They spin in complex four dimensional time-like curves, and give the appearance of growing and shrinking in size as a result when viewed in 3D.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
These potatoes you speak of, do they power the Tardis?
When you are dead, you won't even know that you are dead. It's a pain only felt by others.
Same thing when you are stupid.
modified 19-Nov-21 21:01pm.
|
|
|
|
|
Nah, The Doctor ran out of galvanised nails and copper wire.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
object o = new Potato() ;
o.Rotate();
Well OK, only if it's a spherical potato.
|
|
|
|
|
Doesn't Rotate have parameters? An Axis, a velocity, or force vector?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Does that matter to a spherical potato? Can you even see whether or not a sphere is rotating?
|
|
|
|
|
Well it can - it's got eyes!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
Sometimes people get a little bit LINQ giddy:-
int fileFormtId = ds.Tables["ExpectedDailyBrokerFiles"].AsEnumerable().Where(x => Fits(Utils.ISS(row["File Name"]), x.Field<string>("Mask")) && x.Field<int?>("CHID").HasValue && x.Field<int?>("CHID").Value == Utils.ISInt(row["FileSourceID"])).Select(x => x.Field<int>("FileFormatId")).ToList().FirstOrDefault();
|
|
|
|
|
Well, if you remove all the other cruft, a AsEnumerable().Where().Select().FirstOrDefault() isn't that bad.
However, ToList().FirstOrDefault() is overkill, and with nullable types, why check for HasValue ?
Marc
Latest Article - Merkle Trees
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
..and the mixing type safe and type unsafe field access
..and the fact that it's wrong but I can't see where
..and its a client side join between tables for which a server side view already exists
and so on.
|
|
|
|
|
From code that is licensed under the MIT license, so feel free to use it
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You have to be at least a little bit insane to be a developer. It's OK.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
that code means that it must really be 'true' not 'TRUE' or 1, or even non-zero.
There are a lot of cases where it makes sense. So such code might get enforced by some source code scanner policies.
You learn to honor such tools, when co-working with some code-jockeys
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: There are a lot of cases where it makes sense In some alternate universe perhaps.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
KarstenK's post reminds me of DCL and the many things that test as True -- including (but not limited to) 'Y', '1'...
|
|
|
|
|
Because Javascript equality is so f*cked that you have to know when to use == vs. === , and even then there's some weird BS with the null, empty, void, dunno, you're guess is as good as mine states that a Javascript variable can be in that it only makes sense to equate to a literal string?
Marc
Latest Article - Merkle Trees
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
for (int i = 0; i < foo.Length; i++)
{
addFlag = true;
if (oldFoo != null)
{
for (int j = 0; j < oldFoo.Length; j++)
{
if (foo[i].Guid == oldFoo[j].Guid)
{
addFlag = false;
}
}
}
if (addFlag)
{
newFooList.Add(foo[i]);
}
}
I should start holding code review classes with "WTF is wrong with this pyle of shyte".
Marc
|
|
|
|
|
Marc Clifton wrote: I should start holding code review classes with "WTF is wrong with this pyle of shyte". Too much accolades, right? I also added another for-loop, since you were going through the items in the wrong order.
for (<span int i = 0; i < foo.Length; i++)
{
addFlag = true;
if (oldFoo != null)
for (int j = 0; j < oldFoo.Length; j++)
for (int d = oldFoo.Length; d > 0; d++)
if (foo[i].Guid == oldFoo[j].Guid)
addFlag = false;
if (addFlag)
newFooList.Add(foo[i]);
} Semantically also incorrect, since "addFlag" is unknown at the start. The code should reflect that by using a nullable bool that is set to nothing. That way, you could determine (if an exception occurs) if the bool is unknown, true, or not very true.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: for (int d = oldFoo.Length; d > 0; d++)
There's at least 3 bugs in that one line!
Marc
|
|
|
|
|
You can improve performance by adding a "; " after "for (int d = oldFoo.Length; d > 0; d++) ". But I guess a smart guy like you introduced this possibility for exactly that purpose. Let's hope the compiler did not detect that and optimized it away...
|
|
|
|