GetElement() public static méthode

public static GetElement ( string element ) : Element
element string
Résultat Element
Exemple #1
0
 /// <summary>
 /// Add the principal isotope of the element to this chemical formula
 /// given its chemical symbol
 /// </summary>
 /// <param name="symbol">The chemical symbol of the element to add</param>
 /// <param name="count">The number of the element to add</param>
 public void Add(string symbol, int count)
 {
     try
     {
         Isotope isotope = PeriodicTable.GetElement(symbol).PrincipalIsotope;
         Add(isotope, count);
     }
     catch (KeyNotFoundException e)
     {
         throw new KeyNotFoundException(string.Format("The element symbol '{0}' is not found in the periodic table", symbol), e);
     }
 }
Exemple #2
0
        public int Count(string symbol, int atomicNumber)
        {
            Isotope isotope = PeriodicTable.GetElement(symbol)[atomicNumber];

            return(Count(isotope));
        }
Exemple #3
0
        public int Count(string symbol)
        {
            Element element = PeriodicTable.GetElement(symbol);

            return(Count(element));
        }
Exemple #4
0
 /// <summary>
 /// Remove all the isotopes of an chemical element represented by the symbol
 /// from this chemical formula
 /// </summary>
 /// <param name="symbol">The symbol of the chemical element to remove</param>
 /// <returns>True if the element was present and removed, false otherwise</returns>
 public int Remove(string symbol)
 {
     return(Remove(PeriodicTable.GetElement(symbol)));
 }
Exemple #5
0
 /// <summary>
 /// Remove the principal isotope of the element represented by the symbol
 /// from this chemical formula
 /// </summary>
 /// <param name="symbol">The symbol of the chemical element to remove</param>
 /// <param name="count">The number of isotopes to remove</param>
 public void Remove(string symbol, int count)
 {
     Add(PeriodicTable.GetElement(symbol).PrincipalIsotope, -count);
 }