/// <summary> /// Gets the full name of the type, including any generic type parameters. /// </summary> /// <typeparam name="T">The type of the instance (will be inferred).</typeparam> /// <param name="inInstance">The instance for which to get the type name.</param> /// <returns>The full name of the type, including any generic type parameters.</returns> public static string GetGenericAwareFullTypeName <T>(this T inInstance) { ParameterValidation.EnsureNotNull(inInstance, "inInstance"); Type theType = typeof(T); return(theType.GetGenericAwareTypeName(theType.FullName)); }
/// <summary> /// Initialises a new instance of the <see cref="Path"/> class. /// </summary> /// <param name="inCell0">The in cell1.</param> /// <param name="inCell1">The in cell2.</param> /// <param name="inCell2">The in cell3.</param> internal Path(Cell inCell0, Cell inCell1, Cell inCell2) { ParameterValidation.EnsureNotNull(inCell0, "inCell0"); ParameterValidation.EnsureNotNull(inCell1, "inCell1"); ParameterValidation.EnsureNotNull(inCell2, "inCell2"); if (inCell0 == inCell1) { ThrowDuplicateCellException("inCell0", "inCell1"); } if (inCell1 == inCell2) { ThrowDuplicateCellException("inCell1", "inCell2"); } if (inCell0 == inCell2) { ThrowDuplicateCellException("inCell0", "inCell2"); } // Record the cells in the path. myCells[0] = inCell0; myCells[1] = inCell1; myCells[2] = inCell2; // Register an event handler for when any Cell in the Path changes. foreach (Cell aCell in myCells) { aCell.StateChanged += Path_CellStateChanged; } }
/// <summary> /// Initialises a new instance of the <see cref="Player" /> class. /// </summary> /// <param name="inName">Name of the player.</param> /// <param name="inSymbol">The symbol the player will be using, X or O.</param> protected Player(string inName, CellState inSymbol) { ParameterValidation.EnsureNotNull(inName, "inName"); ParameterValidation.EnsureNotNull(inSymbol, "inSymbol"); if (inSymbol == CellState.Empty) { throw new ArgumentException("Invalid value. A player must choose X or O.", "inSymbol"); } Name = inName; Symbol = inSymbol; }
/// <summary> /// Gets the full name of the type, including any generic type parameters. /// </summary> /// <param name="inType">The type for which to get the full name.</param> /// <returns>The full name of the type, including any generic type parameters.</returns> public static string GetGenericAwareFullTypeName(this System.Type inType) { ParameterValidation.EnsureNotNull(inType, "inType"); return(inType.GetGenericAwareTypeName(inType.FullName)); }