Is there a C# equivalent to python's type() function? -


i learning c# , have basic background in python familiar type() function data type of variable can returned via:

type(myvariable)

is there c# equivalent function?

i asking in context of wanting use such function on c# variable has been created using var eg:

var mynewvariable = "hello!"

i using explicit data types in general eg:

string mynewstring = "hello!"

but wondering data type variable created using var defaults , thought similar type() way check out happening 'under hood` speak.

you can try using gettype() method:

type mytype = myvariable.gettype(); 

for instance

string typename = "my string".gettype().name; // <- "string" 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -