14 Haziran 2013 Cuma

Ternary for checking null for all type

using System;

public static class DataReaderExtensions
{
    public static bool IsDBNull(this IDataReader dataReader, string columnName)
    {
        return dataReader[columnName] == DBNull.Value;
    }
}

checking data reader is null

using System;

public static class DataReaderExtensions
{
    public static bool IsDBNull(this IDataReader dataReader, string columnName)
    {
        return dataReader[columnName] == DBNull.Value;
    }
}

by this extension method you can check datareader column whether null or not

13 Haziran 2013 Perşembe

changing div css class with c#

CODE BEHIND

divMessage.Attributes.Add("class", "info");




CSS CLASS

.
.
.

.info {
    color: #00529B;
    background-color: #BDE5F8;
    background-image: url('info.png');
}

.
.
.

15 Şubat 2013 Cuma

einstein

"The only reason for time is so that everything doesn't happen at once." 

8 Şubat 2013 Cuma

xml file to string

public static string m_xmlFileToString(string strFile)
        {
         
            XmlDocument xmlDoc = new XmlDocument();
            try
            {
                xmlDoc.Load(strFile);
            }
            catch (XmlException e)
            {
                Console.WriteLine(e.Message);
            }
         
            StringWriter sw = new StringWriter();
            XmlTextWriter xw = new XmlTextWriter(sw);
            xmlDoc.WriteTo(xw);
            return sw.ToString();
        }

evren pehlivan yazılım

evren pehlivan yazılım, evren pehlivan yazılım geliştirici