Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Semrush - keyword research tool

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Teach Your Child To Read

Disclosure: My content contains affiliate links.

31,649 questions

41,702 answers

573 users

How to check the data type of a variable in C#

1 Answer

0 votes
using System;

public class VarType
    public static void Main(string[] args)
        int a = 242; 
        Console.WriteLine (a.GetType());
        object obj = "C#"; 
        Type objType = obj.GetType();
        Console.WriteLine (objType);
        double b = 383.023; 
        Console.WriteLine (b.GetType());
        string c = "abc";
        Console.WriteLine (c.GetType());
        bool d = false;
        Console.WriteLine (d.GetType());
        char e = 'a';
        Console.WriteLine (e.GetType());
        uint f = 8293481;
        Console.WriteLine (f.GetType());






Learn & Practice Python
with the most comprehensive set of 13 hands-on online Python courses
Start now

answered Jul 7 by avibootz

Related questions

1 answer 5 views
1 answer 6 views
1 answer 7 views
1 answer 6 views
1 answer 6 views