Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

find type of variable c#

//Method 1 Getting the framework type info
string StringType
Type TheType = StringType.GetType();
//Then TheTypeVariable will have all the information on the type
Console.WriteLine(TheType.Name)
//Using System.Reflection you can also find all the properties ee my answer on

//Method 2 Testing
if(YourVar is YourType) 
  Console.WriteLine("Is your type you are testing for") 
Comment

get type of variable c#

string a = "This is a string";
Console.WriteLine(a.GetType())
Comment

C# GetType

public static Type GetType(string typeName)
{
    var type = Type.GetType(typeName);
    if (type != null) return type;
    foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
    {
        type = a.GetType(typeName);
        if (type != null)
            return type;
    }
    return null;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# string contains any of list 
Csharp :: rotate player unity 
Csharp :: move files from one directory to another using c# 
Csharp :: vscode not showing errors c# 
Csharp :: c# list slice 
Csharp :: get device connected to player input unity 
Csharp :: c# for loop 
Csharp :: c# update control from another thread 
Csharp :: how to see image from website in wpf 
Csharp :: unity cap fps 
Csharp :: prevent asp button from postback 
Csharp :: process.start web 
Csharp :: c# dictionary add 
Csharp :: c# list length 
Csharp :: wpf app how to get all elements which are exposed to script 
Csharp :: textbox in xamarin forms 
Csharp :: CS0101 Unity Error Code 
Csharp :: dotnet call webapi 
Csharp :: raylib c# basic window 
Csharp :: parsing string to int c# 
Csharp :: xmldocument to c# object 
Csharp :: c# datagridview rows clear not working 
Csharp :: c# convert list t to datatable 
Csharp :: change column name in datatable C# 
Csharp :: c# function return 
Csharp :: list to array c# 
Csharp :: remove duplicate characters in a string c# 
Csharp :: check an enum containa an int or not in C# 
Csharp :: datetime month name 
Csharp :: how to find the tag of an objecdt in unity 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =