c# - typeof & GetType -


I serial down a square and the method requires the object type as the parameter.

  string xml = Serialize object (data, typef (class data));   

I think the second parameter is not necessary, how can I remove the second parameter? How can I get the type of data as type ?

You can do this:

  data.GetType ()   

which will be the complete expression for you data

  string xml = the serialize object (data, data) GateType ());   

GetType () is a method declared on object and used on example

Typef () is a statement that can not be used on any type .

 Type  type = Type Type = Data GetType () // Type Type Type Type = Typef (Class Data)    

Comments