コード例 #1
0
        /// <summary>
        /// Gets a <see cref="ContextualParameterInfo"/> for the given <see cref="ParameterInfo"/> instance.
        /// </summary>
        /// <param name="parameterInfo">The parameter info.</param>
        /// <returns>The <see cref="ContextualParameterInfo"/>.</returns>
        public static ContextualParameterInfo ToContextualParameter(this ParameterInfo parameterInfo)
        {
            var key = "Parameter:" + parameterInfo.Name + ":" + parameterInfo.ParameterType.FullName + ":" + parameterInfo.Member.Name + ":" + parameterInfo.Member.DeclaringType.FullName;

            if (!Cache.ContainsKey(key))
            {
                lock (Lock)
                {
                    if (!Cache.ContainsKey(key))
                    {
                        var index = 0;
                        Cache[key] = new ContextualParameterInfo(parameterInfo, ref index);
                    }
                }
            }

            return((ContextualParameterInfo)Cache[key]);
        }
コード例 #2
0
 /// <summary>Returns the contents of the "returns" or "param" XML documentation tag for the specified parameter.</summary>
 /// <param name="parameter">The reflected parameter or return info.</param>
 /// <returns>The contents of the "returns" or "param" tag.</returns>
 public static string GetXmlDocs(this ContextualParameterInfo parameter)
 {
     return(parameter.ParameterInfo.GetXmlDocs());
 }