Esempio n. 1
0
        /// <summary>
        /// Provides extra info about platform service to avoid on-demand creation of service statistics on any
        /// out-of-interface calls or things like 'ToString()'.
        /// </summary>
        private void WriteExtraDescription(IBinaryRawWriter writer)
        {
            if (StatisticsEnabled)
            {
                // Methods names of user interfaces of the service.
                var mtdNames = Service.GetType().GetInterfaces()
                               // No need to measure methods of these interface.
                               .Where(t => t != typeof(IService))
                               .SelectMany(t => t.GetMethods(BindingFlags.Instance | BindingFlags.DeclaredOnly |
                                                             BindingFlags.Public).Select(mtd => mtd.Name)).Distinct();

                writer.WriteStringArray(mtdNames.ToArray());
            }
        }