本文整理汇总了C#中BindingFlags.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# BindingFlags.ToString方法的具体用法?C# BindingFlags.ToString怎么用?C# BindingFlags.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingFlags
的用法示例。
在下文中一共展示了BindingFlags.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProperties
public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
{
Console.WriteLine("Call to GetProperties: {0}", bindingAttr.ToString());
return new PropertyInfo[] { };
}
示例2: ShowFields
private void ShowFields(string hierarchy, Type targetType, object container, BindingFlags bindingAttr)
{
EditorGUI.indentLevel++;
{
FieldInfo[] fields = targetType.GetFields(bindingAttr);
if (fields.Length > 0)
{
EditorGUILayout.LabelField(bindingAttr.ToString());
foreach (FieldInfo field in fields)
{
if (field.DeclaringType == targetType)
{
bool editable = !field.IsLiteral && (editPrivate || field.IsPublic);
object value = field.GetValue(container);
object newValue = ShowKeyValue(hierarchy, field.Name, field.FieldType, value, editable);
if (editable && value != newValue)
{
field.SetValue(container, newValue);
}
}
}
}
}
if (showProperty)
{
PropertyInfo[] fields = targetType.GetProperties(bindingAttr);
if (fields.Length > 0)
{
EditorGUILayout.LabelField(bindingAttr.ToString());
foreach (PropertyInfo field in fields)
{
if (field.DeclaringType == targetType)
{
if (field.CanRead)
{
MethodInfo getter = field.GetGetMethod();
if (getter != null && getter.GetParameters().Length == 0)
{
object value = getter.Invoke(container, null);
ShowKeyValue(hierarchy, field.Name, field.DeclaringType, value, false);
}
}
}
}
}
}
EditorGUI.indentLevel--;
}
示例3: GetMethods
public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
{
Console.WriteLine("Call to GetMethods: {0}", bindingAttr.ToString());
return new MethodInfo[] {};
}
示例4: GetEvents
public override EventInfo[] GetEvents(BindingFlags bindingAttr)
{
Console.WriteLine("Call to GetEvents: {0}", bindingAttr.ToString());
return new EventInfo[] {};
}
示例5: GetEvent
public override EventInfo GetEvent(string name, BindingFlags bindingAttr)
{
Console.WriteLine("Call to GetEvent: {0}, {1}", name, bindingAttr.ToString());
return null;
}
示例6: GetConstructors
public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
{
Console.WriteLine("Call to GetConstructors: {0}", bindingAttr.ToString());
return new ConstructorInfo[] { };
}
示例7: internalGetFieldOrProperty
static object internalGetFieldOrProperty(Type t, string name, BindingFlags b, object obj_or_null)
{
var field = t.GetField(name, b);
if (field == null) {
var property = t.GetProperty (name, b);
if (property == null)
throw new ArgumentException (string.Format ("Field or property name '{0}' not found on object of type '{1}', for binding flags '{2}'", name, t.Name, b.ToString()));
else
return property.GetValue (obj_or_null, null);
}
else
return field.GetValue (obj_or_null);
}