Need a good name for an extension method
-
A basic extension method to implement min (yes, I know there's Math.Min, but I want a fluent implementation, so just go with it):
public static int Min(this int a, int max)
{
return (a > max) ? max : a;
}But what would be a good name for this (which I've tentatively named "MinDelta":
public static int MinDelta(this int a, int delta)
{
return a > a + delta ? a + delta : a;
}Suggestions? Humor? Marc
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
public static int AddIfNegative(this int a, int delta)
{
return delta < 0 ? a + delta : a;
} -
A basic extension method to implement min (yes, I know there's Math.Min, but I want a fluent implementation, so just go with it):
public static int Min(this int a, int max)
{
return (a > max) ? max : a;
}But what would be a good name for this (which I've tentatively named "MinDelta":
public static int MinDelta(this int a, int delta)
{
return a > a + delta ? a + delta : a;
}Suggestions? Humor? Marc
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
Frank. Call it Frank.
The language is JavaScript. that of Mordor, which I will not utter here
This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a fucking golf cart.
"I don't know, extraterrestrial?" "You mean like from space?" "No, from Canada." If software development were a circus, we would all be the clowns. -
A basic extension method to implement min (yes, I know there's Math.Min, but I want a fluent implementation, so just go with it):
public static int Min(this int a, int max)
{
return (a > max) ? max : a;
}But what would be a good name for this (which I've tentatively named "MinDelta":
public static int MinDelta(this int a, int delta)
{
return a > a + delta ? a + delta : a;
}Suggestions? Humor? Marc
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
-D***Size -Asians -AlphaBetaGamma -DeltaDelta -MyFunction1 -Method -AGreaterB -Minimi -IHaveNoIdeaHowToNameThisThing just to hand you a couple ideas
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
} -
Cliftonopolis
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013John Simmons / outlaw programmer wrote:
Cliftonopolis
This stuff is already in the namespace
Clifton.Core.ExtensionMethods
but maybe I'll change that toCliftonpolis
! MarcV.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
-
public static int AddIfNegative(this int a, int delta)
{
return delta < 0 ? a + delta : a;
}Yeah, I though about something like
AddIfNegative
but it's too long. ;) MarcV.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
-
Yeah, I though about something like
AddIfNegative
but it's too long. ;) MarcV.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
AddLT0
(Add if Less Than Zero) :) -
Yeah, I though about something like
AddIfNegative
but it's too long. ;) MarcV.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
Make in an acronym: pAIN
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013 -
A basic extension method to implement min (yes, I know there's Math.Min, but I want a fluent implementation, so just go with it):
public static int Min(this int a, int max)
{
return (a > max) ? max : a;
}But what would be a good name for this (which I've tentatively named "MinDelta":
public static int MinDelta(this int a, int delta)
{
return a > a + delta ? a + delta : a;
}Suggestions? Humor? Marc
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
-
A basic extension method to implement min (yes, I know there's Math.Min, but I want a fluent implementation, so just go with it):
public static int Min(this int a, int max)
{
return (a > max) ? max : a;
}But what would be a good name for this (which I've tentatively named "MinDelta":
public static int MinDelta(this int a, int delta)
{
return a > a + delta ? a + delta : a;
}Suggestions? Humor? Marc
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
MinDelta->Fall / MaxDelta->Climb?
GeoGame for Windows Phone | The Lounge Explained In 5 Minutes
-
Yeah, I though about something like
AddIfNegative
but it's too long. ;) MarcV.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
-
public static int AddIfNegative(this int a, int delta)
{
return delta < 0 ? a + delta : a;
}That changes the behaviour of the code. ;P
int x = int.MinValue.MinDelta(-1); // -2147483648
int y = int.MinValue.AddIfNegative(-1); // 2147483647
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
A basic extension method to implement min (yes, I know there's Math.Min, but I want a fluent implementation, so just go with it):
public static int Min(this int a, int max)
{
return (a > max) ? max : a;
}But what would be a good name for this (which I've tentatively named "MinDelta":
public static int MinDelta(this int a, int delta)
{
return a > a + delta ? a + delta : a;
}Suggestions? Humor? Marc
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
-
A basic extension method to implement min (yes, I know there's Math.Min, but I want a fluent implementation, so just go with it):
public static int Min(this int a, int max)
{
return (a > max) ? max : a;
}But what would be a good name for this (which I've tentatively named "MinDelta":
public static int MinDelta(this int a, int delta)
{
return a > a + delta ? a + delta : a;
}Suggestions? Humor? Marc
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
Has nobody suggested
Shirley
yet? :rolleyes:
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
A basic extension method to implement min (yes, I know there's Math.Min, but I want a fluent implementation, so just go with it):
public static int Min(this int a, int max)
{
return (a > max) ? max : a;
}But what would be a good name for this (which I've tentatively named "MinDelta":
public static int MinDelta(this int a, int delta)
{
return a > a + delta ? a + delta : a;
}Suggestions? Humor? Marc
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
My ;P
Bryian Tan
-
AddLT0
(Add if Less Than Zero) :)Jochen Arndt wrote:
AddLT0
You don't happen to program in assembler do you?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
-
A basic extension method to implement min (yes, I know there's Math.Min, but I want a fluent implementation, so just go with it):
public static int Min(this int a, int max)
{
return (a > max) ? max : a;
}But what would be a good name for this (which I've tentatively named "MinDelta":
public static int MinDelta(this int a, int delta)
{
return a > a + delta ? a + delta : a;
}Suggestions? Humor? Marc
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
-
Jochen Arndt wrote:
AddLT0
You don't happen to program in assembler do you?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
I must confess that I was inspired by some assembler commands like the Microchip
decfsz
(decrement file skip if zero). -
That changes the behaviour of the code. ;P
int x = int.MinValue.MinDelta(-1); // -2147483648
int y = int.MinValue.AddIfNegative(-1); // 2147483647
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
You are off course right.
-
I must confess that I was inspired by some assembler commands like the Microchip
decfsz
(decrement file skip if zero).I do a good bit of maintenance of assmembler code, and darn near all of the labels are beautifully cryptic like that. Switching back and forth between c++ and assmebler is a joy that way. :rolleyes:
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
-
A basic extension method to implement min (yes, I know there's Math.Min, but I want a fluent implementation, so just go with it):
public static int Min(this int a, int max)
{
return (a > max) ? max : a;
}But what would be a good name for this (which I've tentatively named "MinDelta":
public static int MinDelta(this int a, int delta)
{
return a > a + delta ? a + delta : a;
}Suggestions? Humor? Marc
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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