Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Ankush Bansal

@Ankush Bansal
About
Posts
24
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Can you please answer my question on MVVM
    A Ankush Bansal

    I've posted this question[^] May you please take a look and provide inputs? Thx a

    The Lounge question wpf com architecture workspace

  • Whats wrong with this code???
    A Ankush Bansal

    This would fail if obj is double... :-\

    The Weird and The Wonderful beta-testing help question

  • Whats wrong with this code???
    A Ankush Bansal

    Well in theory not... but our middleware doesn't support uint and float so for us (practically) they are bad.

    The Weird and The Wonderful beta-testing help question

  • Whats wrong with this code???
    A Ankush Bansal

    Yes!! Actually the question was raised by the same colleague when I told him its wrong.... :-D

    The Weird and The Wonderful beta-testing help question

  • Whats wrong with this code???
    A Ankush Bansal

    I was assigned a QA bug today and I found this horror code written by my colleague :mad:...

    private static double ConvertToDouble(object obj, out bool good)
    {
    if (obj is double || obj is int)
    {
    good = true;
    return (double)obj;
    }

            good = false;
            return double.NaN;
        }
    

    This code exploded in to

    Exception type: InvalidCastException
    Message: Specified cast is not valid.
    [System.InvalidCastException]

    The Weird and The Wonderful beta-testing help question

  • A morning dream
    A Ankush Bansal

    My eyes were paining, as I coded per requirements, I shouted for it was crowded, and he gifted me diamonds, please read full poem at http://bansalankush.blogspot.in/2011/09/morning-dream.html[^]

    The Lounge html business

  • What about this gem?
    A Ankush Bansal

    I missed to recognize that.... have my vote of 5 for "eye for detail" lol :)

    The Weird and The Wonderful csharp ruby data-structures question

  • got another codebase to work on... its full of surprises!!!
    A Ankush Bansal

    What if I tell you he is an experienced C# developer:cool:

    The Weird and The Wonderful question

  • got another codebase to work on... its full of surprises!!!
    A Ankush Bansal

    Someone told me that String.Copy is faster than raw assignment... So

    _field = string.Copy(s.Field);

    might actually perform better than

    _field = s.Field

    Is he crazy or am I mad to not have known this?? :~ :doh:

    The Weird and The Wonderful question

  • What about this gem?
    A Ankush Bansal

    some might actually do. I know a person who says worlds ending soon, so lets not design!! :wtf:

    The Weird and The Wonderful csharp ruby data-structures question

  • got another codebase to work on... its full of surprises!!!
    A Ankush Bansal

    Yeah... original dev didn't took chances, but fore sure I have to. I'll kick on his a** next time i see him.

    The Weird and The Wonderful question

  • got another codebase to work on... its full of surprises!!!
    A Ankush Bansal

    public class Field
    {

    private readonly string _field;
    private readonly string _table;

    Field()
    {}

    public Field(Field s)
    {
    _table = string.Copy(s.Table);
    _field = string.Copy(s.Field);
    }

    }

    string.Copy for what?:mad:

    The Weird and The Wonderful question

  • What about this gem?
    A Ankush Bansal

    array = new T[1];
    array[array.Length - 1] = handler;

    is

    array[0]

    not allowed in c#?

    The Weird and The Wonderful csharp ruby data-structures question

  • ArrayList.Contains() isn't bool?
    A Ankush Bansal

    "virtual bool" so anyone can override to make it float. :-D :thumbsup:

    The Weird and The Wonderful csharp ruby question

  • Scope fail
    A Ankush Bansal

    Now I am starting to believe that world is moving to .net, :thumbsup: God save JAVA :laugh:

    The Weird and The Wonderful android learning

  • Scope fail
    A Ankush Bansal

    My vote of 5, to accept your mistake. Newton's unspecified law: No code in world is bug free!

    The Weird and The Wonderful android learning

  • ArrayList.Contains() isn't bool?
    A Ankush Bansal

    Just saw this legacy gem

    if(myArrayList.Contains(something)==true || myArrayList.Count>0)
    {
    if(myArrayList.Contains(something)==false)
    {
    default=something;
    }
    else
    {
    default=myArrayList[0];
    }
    }

    this is for C#.net.

    The Weird and The Wonderful csharp ruby question

  • Reflection Optimization
    A Ankush Bansal

    Wow!!!

    obj.GetType().GetProperty(_propertyInfo.Name)

    LOL :-D But it might be useful, if you want to set a value on a different type that has a property with same name!! otherwise :mad:

    The Weird and The Wonderful ruby algorithms performance question

  • return value optimization
    A Ankush Bansal

    yes indeed :laugh::rose:

    The Weird and The Wonderful javascript algorithms performance question

  • return value optimization
    A Ankush Bansal

    Rahul Rajat Singh wrote:

    "it might break something" (WT Elephant?)

    Yes it might break original coder's heart :laugh: I once saw this in production code: :laugh:

    bool func(bool check)
    {
    if(check)
    {
    if(check)
    {
    //Double check to be 100% sure
    }
    }
    }

    The Weird and The Wonderful javascript algorithms performance question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups