Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • C# Data Types
  • C# Decision Making
  • C# Methods
  • C# Delegates
  • C# Constructors
  • C# Arrays
  • C# ArrayList
  • C# String
  • C# Tuple
  • C# Indexers
  • C# Interface
  • C# Multithreading
  • C# Exception
Open In App
Next Article:
DateTime.GetTypeCode() Method in C#
Next article icon

C# | Byte.GetTypeCode() Method

Last Updated : 11 Aug, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

This method is used to return the TypeCode for value type Byte.
 

Syntax: 

public TypeCode GetTypeCode ();

Return Value: It returns the enumerated constant, Byte.
Below programs illustrate the use of Byte.GetTypeCode() Method:
Example 1: 

CSharp




// C# program to demonstrate
// Byte.GetTypeCode() Method
using System;
 
class GFG {
 
    // Main Method
    public static void Main()
    {
 
        // Declaring val1 and val2
        byte val1;
        bool val2;
 
        // initializing the
        // val1 and val2
        val1 = 12;
        val2 = true;
 
        // getting TypeCode
        // using GetTypeCode() method
        TypeCode t1 = val1.GetTypeCode();
        TypeCode t2 = val2.GetTypeCode();
 
        // Display TypeCode
        Console.WriteLine("TypeCode of val1 is {0}", t1);
        Console.WriteLine("TypeCode of val2 is {0}", t2);
    }
}
 
 
Output: 
TypeCode of val1 is Byte TypeCode of val2 is Boolean

 

Example 2:

csharp




// C# program to demonstrate
// Byte.GetTypeCode() Method
using System;
 
class GFG {
 
    // Main Method
    public static void Main()
    {
 
        // Declaring val1 and val2
        byte val1;
        bool val2;
 
        // initializing the
        // val1 and val2
        val1 = 12;
        val2 = true;
 
        // calling get() method
        get(val1);
        get(val2);
    }
 
    // Defining the get() method
    public static void get(byte val)
    {
 
        // getting TypeCode
        // using GetTypeCode() method
        TypeCode t = val.GetTypeCode();
 
        // Display the TypeCode
        Console.WriteLine("TypeCode of {0} is {1}", val, t);
    }
 
    public static void get(bool val)
    {
 
        // getting TypeCode
        // using GetTypeCode() method
        TypeCode t = val.GetTypeCode();
 
        // Display the TypeCode
        Console.WriteLine("TypeCode of {0} is {1}", val, t);
    }
}
 
 
Output: 
TypeCode of 12 is Byte TypeCode of True is Boolean

 

Reference: 

  • https://docs.microsoft.com/en-us/dotnet/api/system.byte.gettypecode?view=netframework-4.7.2


Next Article
DateTime.GetTypeCode() Method in C#

R

RohitPrasad3
Improve
Article Tags :
  • C#
  • CSharp-Byte-Struct
  • CSharp-method

Similar Reads

  • C# | Byte.GetHashCode() Method
    This method is used to return the hash code for the given byte.Syntax: public override int GetHashCode (); Return Value: This method returns a hash code for the current Byte.Below programs illustrate the use of Byte.GetHashCode() Method:Example 1: C/C++ Code // C# program to demonstrate // Byte.GetH
    2 min read
  • C# | Type.GetTypeCode() Method
    Type.GetTypeCode() Method is used to get the underlying type code of the specified Type. Syntax: public static TypeCode GetTypeCode (Type type); Here, it takes the type whose underlying type code to get. Return Value: This method returns the code of the underlying type, or Empty if type is null. Bel
    2 min read
  • DateTime.GetTypeCode() Method in C#
    This method is used to return the TypeCode for value type DateTime. Syntax: public TypeCode GetTypeCode (); Return Value: This method returns the enumerated constant, DateTime. Below programs illustrate the use of DateTime.GetTypeCode() Method Example 1: // C# program to demonstrate the // DateTime.
    1 min read
  • C# | Convert.GetTypeCode(Object) Method
    This method is used to return the TypeCode for the specified object.Syntax: public static TypeCode GetTypeCode (object value); Here, the value is an object that implements the IConvertible interface.Return Value: This method returns the TypeCode for value, or Empty if value is null.Below programs il
    2 min read
  • C# | Type.GetTypeHandle() Method
    Type.GetTypeHandle() Method is used to get the handle for the Type of a specified object. Syntax: public static RuntimeTypeHandle GetTypeHandle (object o); Here, it takes the object for which to get the type handle. Return Value: This method returns The handle for the Type of the specified Object. E
    2 min read
  • C# | Type.GetTypeFromHandle() Method
    Type.GetTypeFromHandle() Method is used to get the type referenced by the specified type handle. Syntax: public static Type GetTypeFromHandle (RuntimeTypeHandle handle); Here, it takes the object which refers to the type. Return Value: This method returns the type referenced by the specified Runtime
    2 min read
  • C# | Char.GetTypeCode() Method with Examples
    This method is used to return the TypeCode for value type Char. Syntax: public TypeCode GetTypeCode (); Return Value: This method returns the enumerated constant, Char.Below programs illustrate the use of Char.GetTypeCode() Method:Example 1: C/C++ Code // C# program to demonstrate // Char.GetTypeCod
    2 min read
  • Boolean.GetTypeCode Method in C# with Examples
    Boolean.GetTypeCode method is used to get the TypeCode for value type Boolean. Syntax: public TypeCode GetTypeCode (); Return Value: This method returns the enumerated constant Boolean. Below programs illustrate the use of the above discussed-method: Example 1: // C# program to illustrate the // Boo
    1 min read
  • C# | Byte.Equals(Byte) Method
    This method is used to return a value indicating whether this instance and a specified Byte object represent the same value. Syntax: public bool Equals (byte obj); Here, obj is a byte object to compare to this instance. Return Value: This method returns true if obj is equal to this instance otherwis
    2 min read
  • C# | Byte.CompareTo(Byte) Method
    This method is used to compare this instance to a specified 8-bit unsigned integer and returns an indication of their relative values.Syntax: public int CompareTo (byte value); Here, the value is an 8-bit unsigned integer to compare.Return Value: This method returns a signed integer that indicates t
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences