示例#1
0
 /// <summary>
 /// Returns an atom by entering its atomic symbol
 /// </summary>
 /// <param name="symbol">Symbol to be searched for</param>
 /// <returns>An atom with the symbol passed</returns>
 public static Atom GetBySymbol(string symbol)
 {
     try
     {
         return(PeriodicTable[PeriodicTable.FindIndex(t => t.Symbol == symbol)]); //Get atom by searching the periodic table for the symbol
     }
     catch (ArgumentOutOfRangeException)
     {
         App.Alert($"Symbol '{symbol}' could not be resolved.");                  //If symbol does not exist, then throw an error
     }
     return(new Atom());
 }