コード例 #1
0
        public string GetAlternativeVariableDeclaration(IVariable variable)
        {
            if (variable == null)
            {
                return("");
            }
            string alternativeDataTypeName = GetAlternativeDataTypeName(variable);
            string alternativeVariableName = variable.GetAlternativeName();

            return(alternativeDataTypeName + " " + alternativeVariableName);
        }
コード例 #2
0
        /// <summary>
        /// Returns the alternative name of the variable if DisplayAlternativeNames is true, otherwise returns the original variable name.
        /// </summary>
        /// <param name="variable"></param>
        /// <returns></returns>
        public static string GetActiveName(this IVariable variable)
        {
            ////DEBUG CODE!  DELETEME
            //var frames = new System.Diagnostics.StackTrace().GetFrames();
            //var toStringMethod = frames.Select(f => f.GetMethod()).Where(m => m.DeclaringType == typeof(Function) && m.Name == "ToString").FirstOrDefault();
            //if (toStringMethod == null)
            //{
            //}

            var    ainFile      = variable.Root;
            string variableName = variable.Name;

            if (ainFile != null && !ainFile.DisplayAlternativeNames)
            {
                return(variableName);
            }
            else
            {
                return(variable.GetAlternativeName());
            }
        }