本文整理汇总了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;
}
示例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}");
}
}
示例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();
}
}
示例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();
}
示例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();
}
}
示例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()))));
}
示例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);
}
示例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);
});
}
示例9: EnumViewModel
public EnumViewModel(Enum ob)
{
Description = ob.GetDescription();
Value = Convert.ToInt32(ob);
}