You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LuCoreUtilsExtensions.cs 501B

12345678910111213141516171819
  1. using System;
  2. using System.Linq;
  3. using System.Reflection;
  4. namespace Luticate2.Utils.Utils
  5. {
  6. public static class LuCoreUtilsExtensions
  7. {
  8. public static string ToSnakeCase(this string str)
  9. {
  10. return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower();
  11. }
  12. public static bool HasProperty(this Type type, string name)
  13. {
  14. return type.GetProperty(name) != null;
  15. }
  16. }
  17. }