Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
AnswerStop posting the same question. Pin
Pete O'Hanlon15-Jun-10 3:07
mvePete O'Hanlon15-Jun-10 3:07 
AnswerRe: add property to Object OR String .... PinPopular
J4amieC15-Jun-10 3:13
J4amieC15-Jun-10 3:13 
QuestionRe: add property to Object OR String .... Pin
jojoba201115-Jun-10 3:22
jojoba201115-Jun-10 3:22 
AnswerRe: add property to Object OR String .... Pin
DaveyM6915-Jun-10 3:30
professionalDaveyM6915-Jun-10 3:30 
AnswerRe: add property to Object OR String .... Pin
J4amieC15-Jun-10 5:11
J4amieC15-Jun-10 5:11 
QuestionRe: add property to Object OR String .... Pin
jojoba201115-Jun-10 3:48
jojoba201115-Jun-10 3:48 
AnswerRe: add property to Object OR String .... Pin
Pete O'Hanlon15-Jun-10 4:07
mvePete O'Hanlon15-Jun-10 4:07 
AnswerRe: add property to Object OR String .... Pin
DaveyM6915-Jun-10 4:17
professionalDaveyM6915-Jun-10 4:17 
You can create an extension method as has already been suggested but how do you expect to test for empty?
Unless ToString has been overridden to return string.Empty then obj.ToString() will never be empty.
C#
namespace YourNamespace
{
    public static class ExtensionMethods
    {
        public static bool IsNullOrEmpty(this Object obj)
        {
            if (obj == null)
                return true;
            // Do your emtpy magical check here and return a bool indicating the result - I have no idea how!
        }
    }
}

Dave

If this helped, please vote & accept answer!


Binging is like googling, it just feels dirtier. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

QuestionRe: add property to Object OR String .... Pin
jojoba201115-Jun-10 4:26
jojoba201115-Jun-10 4:26 
QuestionActiveDirectory c# - WhoLockMe? Pin
noamtzu0015-Jun-10 2:12
noamtzu0015-Jun-10 2:12 
AnswerRe: ActiveDirectory c# - WhoLockMe? Pin
Dave Kreskowiak15-Jun-10 5:21
mveDave Kreskowiak15-Jun-10 5:21 
Questionusing c++ class dll in c# Pin
kk.tvm15-Jun-10 1:27
kk.tvm15-Jun-10 1:27 
AnswerRe: using c++ class dll in c# Pin
DaveyM6915-Jun-10 1:34
professionalDaveyM6915-Jun-10 1:34 
QuestionHow do I view a jpg without using Image.FromStream Pin
TimSWatson15-Jun-10 0:34
TimSWatson15-Jun-10 0:34 
AnswerRe: How do I view a jpg without using Image.FromStream Pin
Luc Pattyn15-Jun-10 0:44
sitebuilderLuc Pattyn15-Jun-10 0:44 
GeneralRe: How do I view a jpg without using Image.FromStream Pin
TimSWatson15-Jun-10 0:48
TimSWatson15-Jun-10 0:48 
GeneralRe: How do I view a jpg without using Image.FromStream Pin
Luc Pattyn15-Jun-10 1:04
sitebuilderLuc Pattyn15-Jun-10 1:04 
Questionconverting long value to datetime Pin
prasadbuddhika14-Jun-10 23:55
prasadbuddhika14-Jun-10 23:55 
AnswerRe: converting long value to datetime Pin
Peace ON15-Jun-10 0:34
Peace ON15-Jun-10 0:34 
AnswerRe: converting long value to datetime Pin
Eddy Vluggen15-Jun-10 0:41
professionalEddy Vluggen15-Jun-10 0:41 
AnswerRe: converting long value to datetime Pin
Pete O'Hanlon15-Jun-10 0:49
mvePete O'Hanlon15-Jun-10 0:49 
AnswerRe: converting long value to datetime PinPopular
Luc Pattyn15-Jun-10 0:50
sitebuilderLuc Pattyn15-Jun-10 0:50 
AnswerRe: converting long value to datetime Pin
prasadbuddhika15-Jun-10 1:05
prasadbuddhika15-Jun-10 1:05 
GeneralRe: converting long value to datetime Pin
DaveyM6915-Jun-10 1:15
professionalDaveyM6915-Jun-10 1:15 
GeneralRe: converting long value to datetime Pin
prasadbuddhika15-Jun-10 1:21
prasadbuddhika15-Jun-10 1:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.