Beispiel #1
0
 /// <summary>
 /// Converts a column <paramref name="name"/> into a default column <paramref name="index"/>.s
 /// </summary>
 /// <param name="name">the name of the default column</param>
 /// <param name="index">receives the default column index</param>
 /// <returns>true if the name was successfully parsed, false on failure</returns>
 public static bool TryParse(string name, out DefaultColumnIndex index)
 {
     if (Enum.IsDefined(typeof(DefaultColumnIndex), name))
     {
         index = (DefaultColumnIndex)Enum.Parse(typeof(DefaultColumnIndex), name);
         return(true);
     }
     index = default(DefaultColumnIndex);
     return(false);
 }
Beispiel #2
0
        /// <summary>
        /// Gets the <code>ColumnInfo</code> for the given <paramref name="index"/>.
        /// </summary>
        /// <param name="index">the index of the default column</param>
        /// <param name="displayMode">the display mode for the offset and length columns</param>
        /// <returns>the column info</returns>
        public static IColumnInfo GetColumnInfo(this DefaultColumnIndex index, DisplayMode displayMode)
        {
            Dictionary <DisplayMode, IColumnInfo> displayModeColumnInfos;

            if (!ColumnInfos.TryGetValue(index, out displayModeColumnInfos))
            {
                throw new ArgumentException("Invalid default column.", "index");
            }

            IColumnInfo columnInfo;

            if (!displayModeColumnInfos.TryGetValue(displayMode, out columnInfo))
            {
                throw new ArgumentException("Invalid display mode.", "index");
            }
            return(columnInfo);
        }
Beispiel #3
0
 /// <summary>
 /// Gets the name of the default column for the given <paramref name="index"/>.
 /// </summary>
 /// <param name="index">the index of the default column</param>
 /// <returns>the name of the column</returns>
 public static string GetName(this DefaultColumnIndex index)
 {
     return(index.GetColumnInfo(default(DisplayMode)).Name);
 }