示例#1
0
 /// <summary>
 /// Gets all the parameter's descendents
 /// </summary>
 /// <param name="p">Contract parameter</param>
 /// <returns>Enumerator of descendents</returns>
 public static IEnumerable <ContractParameter> GetChildren(this IContractParameterHost p)
 {
     for (int i = 0; i < p.ParameterCount; i++)
     {
         yield return(p.GetParameter(i));
     }
 }
        /*
         * Follows the given path to get the parameter.
         */
        protected ContractParameter GetParamFromPath(string path)
        {
            IContractParameterHost h = Root;

            foreach (int i in path.Split(new char[] { ',' }).Select <string, int>(s => Convert.ToInt32(s)))
            {
                h = h.GetParameter(i);
            }
            return(h as ContractParameter);
        }
示例#3
0
        /// <summary>
        /// Gets all the parameter's descendents
        /// </summary>
        /// <param name="p">Contract parameter</param>
        /// <returns>Enumerator of descendents</returns>
        public static IEnumerable <ContractParameter> GetAllDescendents(this IContractParameterHost p)
        {
            for (int i = 0; i < p.ParameterCount; i++)
            {
                ContractParameter child = p.GetParameter(i);
                yield return(child);

                foreach (ContractParameter descendent in child.GetAllDescendents())
                {
                    yield return(descendent);
                }
            }
        }