public Add ( |
||
method | The method. | |
syncAttrib | The method synchronization. | |
리턴 | void |
/// <summary> /// Populates the meta-info from the attributes. /// </summary> /// <param name = "metaInfo">The meta info.</param> /// <param name = "implementation">The implementation type.</param> private static void PopulateMetaInfoFromType(SynchronizeMetaInfo metaInfo, Type implementation) { if (implementation == typeof(object) #if FEATURE_REMOTING || implementation == typeof(MarshalByRefObject) #endif ) { return; } var methods = implementation.GetMethods(MethodBindingFlags); foreach (var method in methods) { var atts = method.GetAttributes <SynchronizeAttribute>(true); if (atts.Length != 0) { metaInfo.Add(method, atts[0]); } } PopulateMetaInfoFromType(metaInfo, implementation.BaseType); }
/// <summary> /// Populates the meta-info from the attributes. /// </summary> /// <param name = "metaInfo">The meta info.</param> /// <param name = "implementation">The implementation type.</param> private static void PopulateMetaInfoFromType(SynchronizeMetaInfo metaInfo, Type implementation) { if (implementation == typeof(object) || implementation == typeof(MarshalByRefObject)) { return; } var methods = implementation.GetMethods(MethodBindingFlags); foreach (var method in methods) { var atts = method.GetAttributes<SynchronizeAttribute>(); if (atts.Length != 0) { metaInfo.Add(method, atts[0]); } } PopulateMetaInfoFromType(metaInfo, implementation.BaseType); }
/// <summary> /// Populates the meta-info from the attributes. /// </summary> /// <param name="metaInfo">The meta info.</param> /// <param name="implementation">The implementation type.</param> private static void PopulateMetaInfoFromType(SynchronizeMetaInfo metaInfo, Type implementation) { if (implementation == typeof(object) || implementation == typeof(MarshalByRefObject)) { return; } MethodInfo[] methods = implementation.GetMethods(MethodBindingFlags); foreach(MethodInfo method in methods) { object[] atts = method.GetCustomAttributes(typeof(SynchronizeAttribute), true); if (atts.Length != 0) { metaInfo.Add(method, atts[0] as SynchronizeAttribute); } } PopulateMetaInfoFromType(metaInfo, implementation.BaseType); }