/// <summary> /// Returns a value indicating whether a method named <paramref name="methodName"/> /// exposed by the <see cref="Type"/> specified by <paramref name="typeName"/> /// from the reference project is also visible to the dependent project. /// </summary> /// <param name="typeName">The full name of the <see cref="Type"/> from the reference project.</param> /// <param name="methodName">The name of the method.</param> /// <param name="parameterTypeNames">The full type names of the method parameters, in the order they must be declared.</param> /// <returns>The <see cref="CodeMemberShareKind"/> representing whether it is shared and in what way.</returns> public CodeMemberShareKind GetMethodShareKind(string typeName, string methodName, IEnumerable <string> parameterTypeNames) { CodeMemberKey key = CodeMemberKey.CreateMethodKey(typeName, methodName, parameterTypeNames == null ? null : parameterTypeNames.ToArray()); SharedCodeDescription description = this.GetSharedCodeDescription(key); return(description.ShareKind); }
/// <summary> /// Returns the <see cref="MethodBase"/> of the method or constructor from the /// set of shared assemblies, if it exists. /// </summary> /// <param name="typeName">The fully qualified type name declaring the method.</param> /// <param name="methodName">The name of the method</param> /// <param name="parameterTypeNames">The fully qualified type names of the method parameters.</param> /// <returns>The <see cref="MethodBase"/> if it exists in the shared assemblies, otherwise <c>null</c></returns> internal MethodBase GetSharedMethod(string typeName, string methodName, IEnumerable <string> parameterTypeNames) { Debug.Assert(!string.IsNullOrEmpty(typeName), "typeName cannot be null"); Debug.Assert(!string.IsNullOrEmpty(methodName), "methodName cannot be null"); MethodBase sharedMethod = null; Type sharedType = this.GetSharedType(typeName); if (sharedType != null) { CodeMemberKey key = CodeMemberKey.CreateMethodKey(typeName, methodName, parameterTypeNames == null ? new string[0] : parameterTypeNames.ToArray()); sharedMethod = this.FindSharedMethodOrConstructor(sharedType, key); } return(sharedMethod); }
/// <summary> /// Creates a new instance of the <see cref="CodeMemberKey"/> class that describes /// a method or a constructor. /// </summary> /// <param name="methodBase">The <see cref="MethodBase"/> of the method or constructor.</param> /// <returns>A new instance that describes that method.</returns> internal static CodeMemberKey CreateMethodKey(MethodBase methodBase) { Debug.Assert(methodBase != null, "methodBase cannot be null"); string[] parameterTypes = methodBase.GetParameters().Select <ParameterInfo, string>(p => p.ParameterType.AssemblyQualifiedName).ToArray(); return(CodeMemberKey.CreateMethodKey(methodBase.DeclaringType.AssemblyQualifiedName, methodBase.Name, parameterTypes)); }