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


C# BindingFlags.ToString方法代碼示例

本文整理匯總了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[] { };
 }
開發者ID:xenocons,項目名稱:visualfsharp,代碼行數:5,代碼來源:TypeProviderInCSharp.cs

示例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--;
    }
開發者ID:pb0,項目名稱:ID0_Test,代碼行數:51,代碼來源:DeepInspector.cs

示例3: GetMethods

 public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
 {
     Console.WriteLine("Call to GetMethods: {0}", bindingAttr.ToString());
     return new MethodInfo[] {};
 }
開發者ID:xenocons,項目名稱:visualfsharp,代碼行數:5,代碼來源:TypeProviderInCSharp.cs

示例4: GetEvents

 public override EventInfo[] GetEvents(BindingFlags bindingAttr)
 {
     Console.WriteLine("Call to GetEvents: {0}", bindingAttr.ToString());
     return new EventInfo[] {};
 }
開發者ID:xenocons,項目名稱:visualfsharp,代碼行數:5,代碼來源:TypeProviderInCSharp.cs

示例5: GetEvent

 public override EventInfo GetEvent(string name, BindingFlags bindingAttr)
 {
     Console.WriteLine("Call to GetEvent: {0}, {1}", name, bindingAttr.ToString());
     return null;
 }
開發者ID:xenocons,項目名稱:visualfsharp,代碼行數:5,代碼來源:TypeProviderInCSharp.cs

示例6: GetConstructors

 public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
 {
     Console.WriteLine("Call to GetConstructors: {0}", bindingAttr.ToString());
     return new ConstructorInfo[] { };
 }
開發者ID:xenocons,項目名稱:visualfsharp,代碼行數:5,代碼來源:TypeProviderInCSharp.cs

示例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);
 }
開發者ID:kanwalpreet18,項目名稱:rClr,代碼行數:13,代碼來源:ClrFacade.cs


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