Questions tagged «generic-constraints»

21
ටී එනුම් එකකට සීමා කරන සාමාන්‍ය ක්‍රමයක් සාදන්න
එම Enum.Parseසංකල්පය දීර් extend කිරීම සඳහා මම ශ්‍රිතයක් ගොඩනඟමි එනුම් අගයක් සොයාගත නොහැකි නම් පෙරනිමි අගයක් විග්‍රහ කිරීමට ඉඩ දෙන්න නඩුව සංවේදී නොවේ එබැවින් මම පහත සඳහන් දේ ලිව්වෙමි. public static T GetEnumFromString<T>(string value, T defaultValue) where T : Enum { if (string.IsNullOrEmpty(value)) return defaultValue; foreach (T item in Enum.GetValues(typeof(T))) …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.