csharp type of string

Code Example - csharp type of string

                
                        //Exampled String
string str = "MyString";

//Getting Type of "MyString"
string typeOfStr = str.GetType().ToString();
//Show our Type
Console.WriteLine(typeOfStr);

// Or in short:
Console.WriteLine(str.GetType());
                    
                
 

csharp type from string

                        
                                Type type = Type.GetType("Namespace.MyClass, MyAssembly");
                            
                        
 

Related code examples