当前位置: 首页>>代码示例>>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;未经允许,请勿转载。