Better way to cast object to int

This is probably trivial, but I can’t think of a better way to do it. I have a COM object that returns a variant which becomes an object in C#. The only way I can get this into an int is

int test = int.Parse(string.Format("{0}", myobject))

Is there a cleaner way to do this? Thanks

11 Answers
11

Leave a Comment