Oww...
-
This one bit me this morning... half an hour wasted:
string stepType = ...;
if (stepType != typeof(Link).GetType().FullName)
{
....
}It was, of course, the unnecessary GetType() call. Shame on me! ;)
Luca The Price of Freedom is Eternal Vigilance. -- Wing Commander IV En Það Besta Sem Guð Hefur Skapað, Er Nýr Dagur. (But the best thing God has created, is a New Day.) -- Sigur Ròs - Viðrar vel til loftárása
-
This one bit me this morning... half an hour wasted:
string stepType = ...;
if (stepType != typeof(Link).GetType().FullName)
{
....
}It was, of course, the unnecessary GetType() call. Shame on me! ;)
Luca The Price of Freedom is Eternal Vigilance. -- Wing Commander IV En Það Besta Sem Guð Hefur Skapað, Er Nýr Dagur. (But the best thing God has created, is a New Day.) -- Sigur Ròs - Viðrar vel til loftárása
what happens when you change the name of the class? Either way, it's flawed ;P The better solution (IMO) would be:
Type stepType = ...;
if (stepType != typeof(Link))
{
...
}(it will be faster too!)
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 3 out now -
what happens when you change the name of the class? Either way, it's flawed ;P The better solution (IMO) would be:
Type stepType = ...;
if (stepType != typeof(Link))
{
...
}(it will be faster too!)
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 3 out nowleppie wrote:
what happens when you change the name of the class?
It'll take him another half an hour ;P
Mostly, when you see programmers, they aren't doing anything. One of the attractive things about programmers is that you cannot tell whether or not they are working simply by looking at them. Very often they're sitting there seemingly drinking coffee and gossiping, or just staring into space. What the programmer is trying to do is get a handle on all the individual and unrelated ideas that are scampering around in his head. (Charles M Strauss)
-
what happens when you change the name of the class? Either way, it's flawed ;P The better solution (IMO) would be:
Type stepType = ...;
if (stepType != typeof(Link))
{
...
}(it will be faster too!)
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 3 out nowWell, it's part of a snippet that handled deserialization from XML of certain objects, stepType is an attribute value. If I had the live Type in memory, I'd have probably used
if (stepType is Link)
. However it finally got refactored away with a proper object hierarchy :)Luca The Price of Freedom is Eternal Vigilance. -- Wing Commander IV En Það Besta Sem Guð Hefur Skapað, Er Nýr Dagur. (But the best thing God has created, is a New Day.) -- Sigur Ròs - Viðrar vel til loftárása
-
Well, it's part of a snippet that handled deserialization from XML of certain objects, stepType is an attribute value. If I had the live Type in memory, I'd have probably used
if (stepType is Link)
. However it finally got refactored away with a proper object hierarchy :)Luca The Price of Freedom is Eternal Vigilance. -- Wing Commander IV En Það Besta Sem Guð Hefur Skapað, Er Nýr Dagur. (But the best thing God has created, is a New Day.) -- Sigur Ròs - Viðrar vel til loftárása
-
This one bit me this morning... half an hour wasted:
string stepType = ...;
if (stepType != typeof(Link).GetType().FullName)
{
....
}It was, of course, the unnecessary GetType() call. Shame on me! ;)
Luca The Price of Freedom is Eternal Vigilance. -- Wing Commander IV En Það Besta Sem Guð Hefur Skapað, Er Nýr Dagur. (But the best thing God has created, is a New Day.) -- Sigur Ròs - Viðrar vel til loftárása
"En Það Besta Sem Guð Hefur Skapað, Er Nýr Dagur. (But the best thing God has created, is a New Day.) -- Sigur Ròs - Viðrar vel til loftárása" Hi Luca, That fascinating quote compelled me to go a-google; I assumed it was a quote from some medieval Scandinavian skald sitting on a hill watching a battle (or a nice plundering raid on an English town) commence and making notes for his edda or saga :) Even more fascinating that it's a quote from a contemporary Icelandic ambient music group, and that song title translates as "A Good Day for Airstrikes." thanks, Bill
"The greater the social and cultural distances between people, the more magical the light that can spring from their contact." Milan Kundera in Testaments Trahis