12345678910111213141516171819 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace gpt_api.Core.Extensions
- {
- /// <summary>
- /// 枚举扩展方法
- /// </summary>
- public static class EnumExtension
- {
- public static T ToEnum<T>(this string str)
- {
- return (T)Enum.Parse(typeof(T), str);
- }
- }
- }
|