Class Square
Represents a chess square.
Inheritance
Inherited Members
Namespace: ChessSharp.SquareData
Assembly: ChessSharp.dll
Syntax
public class Square
Constructors
| Improve this Doc View SourceSquare(File, Rank)
Initializes a new instance of the Square
class.
Declaration
public Square(File file, Rank rank)
Parameters
Type | Name | Description |
---|---|---|
File | file | A File enum representing the file of the square. |
Rank | rank | A Rank enum representing the rank of the square. |
Square(Char, Int32)
Initializes a new instance of the Square class.
Declaration
public Square(char file, int rank)
Parameters
Type | Name | Description |
---|---|---|
System.Char | file | A char representing the file of the square. |
System.Int32 | rank | A char representing the rank of the square. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Either |
Properties
| Improve this Doc View SourceFile
Gets the File of the square.
Declaration
public File File { get; }
Property Value
Type | Description |
---|---|
File |
Rank
Gets the Rank of the square.
Declaration
public Rank Rank { get; }
Property Value
Type | Description |
---|---|
Rank |
Methods
| Improve this Doc View SourceEquals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
Parse(String)
Parses a string representation of the square.
Declaration
public static Square Parse(string square)
Parameters
Type | Name | Description |
---|---|---|
System.String | square | The string representation of the square. |
Returns
Type | Description |
---|---|
Square | Returns a Square object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The given |
System.ArgumentException | The given |
System.ArgumentOutOfRangeException | Either the file or the rank char of the |
ToString()
Converts the given square to a string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | Returns string representation of the square. For example, it returns "G2" for a square with G file and second rank. |
Overrides
Operators
| Improve this Doc View SourceImplicit(String to Square)
Declaration
public static implicit operator Square(string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s |
Returns
Type | Description |
---|---|
Square |