/// <summary>
 /// Registers a new dimension with the specified <paramref name="name"/> and returns the created dimension. If a
 /// dimension with the specified name already exists, the existing dimension will be returned instead.
 /// </summary>
 /// <param name="name">The name of the dimension.</param>
 /// <param name="groupName">The group name of the dimension.</param>
 /// <param name="obsolete">Whether the dimension is obsolete.</param>
 public static AnalyticsDimension Register(string name, string groupName, bool obsolete)
 {
     if (All.TryGetValue(name, out var dimension))
     {
         return(dimension);
     }
     dimension = new AnalyticsDimension(name, groupName, obsolete);
     All.Add(dimension.Name, dimension);
     return(dimension);
 }
示例#2
0
 /// <summary>
 /// Adds the specified dimension to the collection.
 /// </summary>
 /// <param name="dimension">The dimension to add.</param>
 public void Add(AnalyticsDimension dimension)
 {
     _list.Add(dimension);
 }
 /// <summary>
 /// Attempts to find dimension with the specified <paramref name="name"/>.
 /// </summary>
 /// <param name="name">The name of the dimension.</param>
 /// <param name="dimension">The dimension.</param>
 /// <returns><c>true</c> if the dimension was found, otherwise <c>false</c>.</returns>
 public static bool TryGet(string name, out AnalyticsDimension dimension)
 {
     return(All.TryGetValue(name, out dimension));
 }