當前位置: 首頁>>代碼示例>>C#>>正文


C# Enum.GetDescription方法代碼示例

本文整理匯總了C#中System.Enum.GetDescription方法的典型用法代碼示例。如果您正苦於以下問題:C# Enum.GetDescription方法的具體用法?C# Enum.GetDescription怎麽用?C# Enum.GetDescription使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Enum的用法示例。


在下文中一共展示了Enum.GetDescription方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetTemplateDelegate

        private View GetTemplateDelegate(int i, Enum parameter, View convertView)
        {
            var view = convertView;
            if (view == null)
            {
                view = MainActivity.CurrentContext.LayoutInflater.Inflate(Resource.Layout.AnimeSearchTypeItem, null);
                view.Click += ViewOnClick;
            }

            view.FindViewById<TextView>(Resource.Id.AnimeSearchTypeItemTextView).Text = parameter.GetDescription();
            view.Tag = parameter.Wrap();

            return view;
        }
開發者ID:Mordonus,項目名稱:MALClient,代碼行數:14,代碼來源:AnimeTypeSearchFragment.cs

示例2: CreateEnum

        public static IJavascriptObject CreateEnum(this IJavascriptObjectFactory @this, Enum ienum)
        {
            try
            {
                var res = @this.CreateObject($"new Enum('{ienum.GetType().Name}',{Convert.ToInt32(ienum)},'{ienum.ToString()}','{ienum.GetDescription()}')");

                if ((res == null) || (!res.IsObject))
                    throw ExceptionHelper.GetUnexpected();

                return res;
            }
            catch
            {
                throw ExceptionHelper.Get($"Unexpected Error creating enum: {ienum}");
            }
        }
開發者ID:David-Desmaisons,項目名稱:MVVM.CEF.Glue,代碼行數:16,代碼來源:IJavascriptObjectFactoryExtension.cs

示例3: CreateEnum

        public static IJavascriptObject CreateEnum(this IJavascriptObjectFactory @this, Enum ienum)
        {
            try
            {
                IJavascriptObject res = @this.CreateObject(string.Format("new Enum('{0}',{1},'{2}','{3}')",
                    ienum.GetType().Name, Convert.ToInt32(ienum), ienum.ToString(), ienum.GetDescription()));

                if ((res == null) || (!res.IsObject))
                    throw ExceptionHelper.NoKoExtension();

                return res;
            }
            catch
            {
                throw ExceptionHelper.NoKoExtension();
            }
        }
開發者ID:yovannyr,項目名稱:MVVM.CEF.Glue,代碼行數:17,代碼來源:IJavascriptObjectFactory_CreateEnum_extesion.cs

示例4: EncodeEnum

        /// <summary>
        /// 編碼枚舉類型的值
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="value"></param>
        /// <param name="blankText"></param>
        /// <param name="zeroText"></param>
        /// <returns></returns>
        public static string EncodeEnum(this HtmlHelper htmlHelper, Enum value, string blankText, string zeroText)
        {
            if (value == null)
            {
                return blankText;
            }

            if (zeroText != null)
            {
                int intValue = Convert.ToInt32(value);
                if (intValue == 0)
                {
                    return zeroText;
                }
            }

            return value.GetDescription();
        }
開發者ID:shenlos,項目名稱:dukous-boss,代碼行數:26,代碼來源:EncodeExtensions.cs

示例5: AddLabel

        /// <summary>
        /// Adds the label.
        /// </summary>
        /// <param name="method">The method.</param>
        /// <param name="height">The height.</param>
        private void AddLabel(Enum method, int height)
        {
            Label tempLabel = null;
            try
            {
                tempLabel = new Label();
                toolTip.SetToolTip(tempLabel, method.GetDescription());
                tempLabel.AutoSize = false;
                tempLabel.Text = method.GetHeader();
                tempLabel.TextAlign = ContentAlignment.MiddleLeft;
                tempLabel.Location = new Point(labelMethod.Location.X, height);
                tempLabel.Width = labelMethod.Width;
                tempLabel.Height = RowHeight;

                Label label = tempLabel;
                tempLabel = null;

                Controls.Add(label);
            }
            finally
            {
                tempLabel?.Dispose();
            }
        }
開發者ID:RapidFiring,項目名稱:evemon,代碼行數:29,代碼來源:UpdateSettingsControl.cs

示例6: CreateEnum

 public JSValue CreateEnum(Enum ienum)
 {
     return _IWebView.EvaluateSafe(() =>
         CheckUpdate(_IWebView.ExecuteJavascriptWithResult(string.Format("new Enum('{0}',{1},'{2}','{3}')",
                         ienum.GetType().Name, Convert.ToInt32(ienum), ienum.ToString(), ienum.GetDescription()))));
 }
開發者ID:skyaxl,項目名稱:MVVM-for-awesomium,代碼行數:6,代碼來源:LocalBuilder.cs

示例7: SetAttiValue

 /// <summary>
 /// 設置屬性值
 /// </summary>
 /// <param name="attiName"></param>
 /// <param name="vaName"></param>
 /// <param name="inst"></param>
 public void SetAttiValue(string attiName, string vaName, Enum inst)
 {
     string desp = inst.GetDescription();
     HtmlAtti atti = this.NewOrGetAtti(attiName);
     atti.SetValue(vaName, desp);
 }
開發者ID:BeiMeng,項目名稱:Util.BootStrap,代碼行數:12,代碼來源:HtmlTag.cs

示例8: CreateEnum

        public CefV8Value CreateEnum(Enum ienum)
        {
            return _CefV8Context.Evaluate(() =>
                {
                    CefV8Value res = null;
                    CefV8Exception excep = null;

                    _CefV8Context.Context.TryEval(string.Format("new Enum('{0}',{1},'{2}','{3}')",
                        ienum.GetType().Name, Convert.ToInt32(ienum), ienum.ToString(), ienum.GetDescription()),
                        out res, out excep);
             
                    return CheckUpdate(res);
                });
        }
開發者ID:timfish,項目名稱:MVVM.CEF.Glue,代碼行數:14,代碼來源:LocalBuilder.cs

示例9: EnumViewModel

 public EnumViewModel(Enum ob)
 {
     Description = ob.GetDescription();
     Value = Convert.ToInt32(ob);
 }
開發者ID:theriddlebrothers,項目名稱:Honeypot,代碼行數:5,代碼來源:EnumViewModel.cs


注:本文中的System.Enum.GetDescription方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。