12345678910111213141516171819 |
- using System;
- using System.Linq;
- using System.Reflection;
-
- namespace Luticate2.Utils.Utils
- {
- public static class LuCoreUtilsExtensions
- {
- public static string ToSnakeCase(this string str)
- {
- return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower();
- }
-
- public static bool HasProperty(this Type type, string name)
- {
- return type.GetProperty(name) != null;
- }
- }
- }
|