本文整理匯總了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);
}