C# string Parsing to variable types

后端 未结 7 798
暖寄归人
暖寄归人 2021-02-02 04:55

I want to parse a string into a type easily, but I don\'t want to write wrapper code for each type, I just want to be able to do \"1234\".Parse() or the like and have it return

7条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-02 05:19

    You could write a wrapper function that calls tryParse for each type that you want to support.

提交回复
热议问题