Datatype finding in C#

64 views Asked by At

I have 10 data's in string array.In this 10 data, each of the data's could be integer/string/double/DateTime format. based on these 10 datatype we have to find common datatype.

Eg1: string["10","20","3","45"] -> o/p: int.

Eg2: string["10","2o","3","4","5.0","4","56"] -> o/p : float.

Eg3: string["10","20.5","ten","45"] -> o/p: string

1

There are 1 answers

0
Hal On BEST ANSWER

Iterate : TryParse double, TryParse Int, TryParse DateTime, or string. Done.