Get Object Value Or Default - CSharp System

CSharp examples for System:Object

Description

Get Object Value Or Default

Demo Code


using System.Text;
using System.IO;//from  w  w  w  .  j  av a  2 s  .c  o  m
using System.Globalization;
using System.Collections.Generic;
using System;

public class Main{
        public static string GetValueOrDefault(this object value, string defaultValue)
        {
            if (value == null)
            {
                return defaultValue;
            }

            return value.ToString();
        }
}

Related Tutorials