コード例 #1
0
        public static EnumerationMember[] GetEnumerationMembers(Type enumType)
        {
            Array enumValues = Enum.GetValues(enumType);

            return((from object enumValue in enumValues
                    select new EnumerationMember
            {
                Value = enumValue,
                Description = EnumTools.GetEnumDescription(enumValue, enumType)
            }).ToArray());
        }
コード例 #2
0
        /// <summary>
        /// If enum implements the DescriptionAttribute then returns this tostring
        /// otherwise returns enum as string.
        /// </summary>
        public static string ToDescriptionString(this Enum value)
        {
            if (value == null)
            {
                throw new NullReferenceException(nameof(value));
            }

            string info = EnumTools.GetEnumDescription(value, value.GetType());

            if (string.IsNullOrWhiteSpace(info))
            {
                return(value.ToString());
            }

            return(info);
        }
コード例 #3
0
        public Auth(App app, string authUri = BaseUrls.OauthUrl, Scope scope = Scope.Trading, Mode mode = Mode.Live)
        {
            App   = app;
            Scope = scope;
            Mode  = mode;

            var authURIBuilder = new UriBuilder(authUri);

            authURIBuilder.Path += "auth";

            authURIBuilder.Query = $"client_id={App.ClientId}&redirect_uri={App.RedirectUri}&scope={EnumTools.GetEnumDescription(Scope)}";

            AuthUri = authURIBuilder.Uri;
        }