Must love to run twice
-
The following code I found some developer used very often. I just wonder might he loves to run getStatus twice to make sure his code executed perfect. if(GetStatus(id) != "") string status = GetStatus(id); private string GetStatus(int recordId) { string s = ""; //First, use ADO.NET to get the Status of this recordId //Then, assign the status to a string. if(//Check to make sure there is data and not DB null) s = //The data; //Finally, return the string return s; }
-
The following code I found some developer used very often. I just wonder might he loves to run getStatus twice to make sure his code executed perfect. if(GetStatus(id) != "") string status = GetStatus(id); private string GetStatus(int recordId) { string s = ""; //First, use ADO.NET to get the Status of this recordId //Then, assign the status to a string. if(//Check to make sure there is data and not DB null) s = //The data; //Finally, return the string return s; }
Possibly he went from the
VB
realm. :-DIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
The following code I found some developer used very often. I just wonder might he loves to run getStatus twice to make sure his code executed perfect. if(GetStatus(id) != "") string status = GetStatus(id); private string GetStatus(int recordId) { string s = ""; //First, use ADO.NET to get the Status of this recordId //Then, assign the status to a string. if(//Check to make sure there is data and not DB null) s = //The data; //Finally, return the string return s; }
It is an ambitious way to save a memory variable that people succumb to a bad performance of an application by calling a lengthier function twice or more.
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
All the world's a stage, And all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts... --William Shakespeare -
The following code I found some developer used very often. I just wonder might he loves to run getStatus twice to make sure his code executed perfect. if(GetStatus(id) != "") string status = GetStatus(id); private string GetStatus(int recordId) { string s = ""; //First, use ADO.NET to get the Status of this recordId //Then, assign the status to a string. if(//Check to make sure there is data and not DB null) s = //The data; //Finally, return the string return s; }
If it's worth getting, it's worth getting twice. :-D
-
The following code I found some developer used very often. I just wonder might he loves to run getStatus twice to make sure his code executed perfect. if(GetStatus(id) != "") string status = GetStatus(id); private string GetStatus(int recordId) { string s = ""; //First, use ADO.NET to get the Status of this recordId //Then, assign the status to a string. if(//Check to make sure there is data and not DB null) s = //The data; //Finally, return the string return s; }
That is a race just waiting to happen!!! In C# I try not to use an 'is' followed by a cast for the same reason. The following code reads so much nicer:
Bar bar = o as Bar;
if(bar != null)
{
}than this:
if(o is Bar && !object.ReferenceEquals(o, null))
{
}