|
Don't forget the abomination that is
throw (ex);
|
|
|
|
|
Gaaah!!!
throw new Stone();
|
|
|
|
|
I also like:
WebConfigurationManager.ConnectionStrings("connStr").ToString()
Maybe he wasn't confident enough that WebConfigurationManager.ConnectionStrings("connStr") would return a string.
Maybe he should be sure with:
WebConfigurationManager.ConnectionStrings("connStr").ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString()
|
|
|
|
|
I wonder... What moves a man to type an "I" at the begining of a bad named DataAccesslayer class for naming a static class which is not static, and even has a default constructor to construct absolutely nothing?
|
|
|
|
|
Salary aayi hain.... Salary aayi hain ... bade dine ke baad ham kangalo ke paas thodi haryali aayi hain
For any question : http://pranayamr.blogspot.com/
vote my article :
http://www.codeproject.com/KB/cs/LINQ_Visual_Representatio.aspx
http://www.codeproject.com/KB/aspnet/jQuery_To_WCF.aspx
|
|
|
|
|
A translation would be nice.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
I disagree. Even before knowing what it means, I doubt it has any value.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
Perhaps. I tried Google translator, but it couldn't handle it.
Oh, well. It might be something amusing, but it doesn't belong in the forum for coding horrors.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
Not at all amusing. I can translate it for you but it is not at all worth it. Also doesn't belong to any forums.
|
|
|
|
|
The salary has arrived,
the day has came, my salary has arrived...
after long hard working days,
in the hands of moneyless, the greenery has arrived...
---------------
I hope this helps, to non-hindi speaking people.
|
|
|
|
|
I think you should have posted this in the General Indian Topics forum...
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
This is stupid and lame. Please remove it and don't even think about posting it in General Indian Topics forum.
|
|
|
|
|
No more lame than many of the things that have been posted in the Lounge section.
My only objection was that it belongs in the General Indian Topics forum or the Lounge forum (with a translation).
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
{
IterateParentsForLoginId( Parent );
}
private void IterateParentsForLoginId(Control parent)
{
if (typeof( Page ).IsAssignableFrom( parent.GetType() ))
{
_loggedInId = ((Page)parent).LoggedInId;
}
else
{
if (parent.Parent != null)
IterateParentsForLoginId( parent.Parent );
else
throw new InvalidOperationException(
"To ensure proper page functioning, the containing page for this control must derive from OURNAMESPACE.Page." );
}
}
<< Nearly all men can stand adversity, but if you want to test a man's character, give him power. >>
|
|
|
|
|
the method should be called RecursiveParentsForLoginId
|
|
|
|
|
If rewritten properly this method is tail-recursive and thus ipso facto iterative (by nature).
|
|
|
|
|
Not so long ago, I came across this:
public class StringUtils
{
public bool IsNullOrEmpty(string s)
{
return string.IsNullOrEmpty(s);
}
}
What a gem, hey? I don't know whether to laugh or cry...
|
|
|
|
|
Lol, awesome. Though I can imagine at least a few reasons why this would sort of make sense.
- If somebody moved all the string handling functions to a single class so they don't have to remember the location of all of them, that would make some sense. Not much, but some.
- If somebody was working with a tool that requires a function be exposed by a custom class in order to make use of it. For example, I work with an open source tool called Umbraco, and it makes heavy use of XSLT. In order to use a built-in .Net Framework function from XSLT, I have to create a wrapper function and change some configuration settings to let the XSLT know which DLL to use.
- IsNullOrEmpty was new to .Net Framework 2.0. If they were using a version of .Net before 2.0, they may have created their own implementation, then replaced it with the .Net version.
|
|
|
|
|
Option #1: If I were the boss and this was the case, the guy who did this would be gone (if I could find out who it was, that is)
Option #2: Pretty sure that's not the case here; it is actually a class inside a framework used for building other apps.
Option #3: Perhaps yes. I suppose this could explain it. Although as far as I am aware, I believe it was originally written in .NET 2 already. Maybe the guy came from using .NET 1 and didn't realise this was there in 2.0. :-s LOL.
|
|
|
|
|
Option 1: If you can't find out who did it, the code is the least of your problems. Has your boss ever heard of source control
|
|
|
|
|
LOL. It's a HUGE company and the code is from a different team and from a couple years back... not to mention everyone where I live is named "Nguyen", so I wouldn't have a clue. Hehe
|
|
|
|
|
The simple idea of making this kind of stuff is simply horrid, but the fact that this horrid method is not static is still more horrifying.
|
|
|
|
|
LOL. Actually, my bad; I was quickly writing it up out of memory - I do believe it was static. I dont think anyone can be that idiotic. If I find someone like that, I'm definitely packing my bags and moving on to other things!
|
|
|
|
|
gordon_matt wrote: I dont think anyone can be that idiotic.
Be careful when you say that. Code is like the Darwin Awards... You never know when some moron with a PhD comes up with what they "think" is a great idea...
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
in that case, could it be that it was written like this:
public static class StringUtils
{
public static bool IsNullOrEmpty(this string s)
{
return string.IsNullOrEmpty(s);
}
}
then you can simplify the calling code a bit:
string a = "11";
string b = "";
string c = null;
Console.Out.WriteLine("a -> {0}, b -> {1}, c -> {2}", a.IsNullOrEmpty(), b.IsNullOrEmpty(), c.IsNullOrEmpty());
instead of
Console.Out.WriteLine("a -> {0}, b -> {1}, c -> {2}", string.IsNullOrEmpty(a), string.IsNullOrEmpty(b), string.IsNullOrEmpty(c));
I wouldn't argue if this is a bad practice or not, but it makes some sense at least (ignoring the issue of calling a seemingly instance method on null reference)
|
|
|
|