Convert char To Byte - CSharp System

CSharp examples for System:Char

Description

Convert char To Byte

Demo Code

// Copyright (c)2008-2011 Mark II Software, LLC.  All Rights Reserved.
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*w  ww .j  a v a  2  s .co  m*/

public class Main{
        public static byte ToByte(this char c)
        {
            byte by = 0;
            if (Byte.TryParse(c.ToString(), out by))
                return by;
            else
                return 0;
        }
}

Related Tutorials