JavaScript StartsWith / EndsWith


Warning: Illegal string offset 'show-content' in /home5/programz/hyperbytelabs.com/wp-content/themes/onepagepro/single.php on line 16

Warning: Illegal string offset 'show-content' in /home5/programz/hyperbytelabs.com/wp-content/themes/onepagepro/single.php on line 28

Warning: Illegal string offset 'show-content' in /home5/programz/hyperbytelabs.com/wp-content/themes/onepagepro/single.php on line 85

Warning: Illegal string offset 'show-content' in /home5/programz/hyperbytelabs.com/wp-content/themes/onepagepro/single.php on line 119
IsNullOrEmpty function for all objects

C# IsNullOrEmpty for all objects

    This will test for IsNullOrEmpty for all objects including string and you can specify multiple values including multiple types.  E.g. “”, null, -1 as a prarms based object or array

    public static bool IsNullOrEmpty(object obj, params object[] emptyValues)
    {
        object[] defaultEmptyValues = new object[] { "", null, -1 };
    
        if (emptyValues == null)
        {
            emptyValues = defaultEmptyValues;
        }
        foreach (object emptyValue in emptyValues)
        {
            if (obj == emptyValue) return true;
        }
        return false;
    
    }

     

    X
    X