Skip to main content
se añadieron 240 caracteres en el cuerpo
Origen Enlace
Pikoh
  • 17.5k
  • 9
  • 41
  • 56

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace TrackerLibrary { /// /// Represent what the prize if for the given place. /// public class PrizeModel { /// /// The unique identifier for the prize /// public int Id { get; set; } /// /// The numeric identifier for the place(for the second place, etc.) /// public int PlaceNumber { get; set; } /// /// The friendly name for the place (second place, first runner up, etc.) ///

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TrackerLibrary
{
    /// <summary>
    /// Represent what the prize if for the given place.
    /// </summary>
    public class PrizeModel
    {
        /// <summary>
        /// The unique identifier for the prize
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// The numeric identifier for the place(for the second place, etc.)
        /// </summary>
        public int PlaceNumber { get; set; }
        /// <summary>
        /// The friendly name for the place (second place, first runner up, etc.)
        /// </summary>

        public string PlaceName { get; set; }

        /// <summary>
        /// The find amount this place earns or zero if it is not used.
        /// </summary>

        public decimal PrizeAmount { get; set; }
        /// <summary>
        /// The number that represent the percentage of theoverall take or
        /// zero if it is not used. The percentage if a fraction of 1 (so O.S for
        /// 50%)
        /// </summary>

        public double PrizePercentage { get; set; }

        public PrizeModel()
        {
 
        }

        public PrizeModel(string placeName, string placeNumber, string placeAmount, string placePercentage)
        {
            PlaceName = PlaceName;
            int placeNumberValue = 0;
            int.TryParse(placeNumber, out placeNumberValue);
            placeNumber = placeNumberValue; //AQUI ESTA EL ERROR

            decimal prizeAmountValue = 0;
            decimal.TryParse(prizeAmount, out prizeAmountValue);
            PrizeAmount = prizeAmountValue;
        }


        public string prizeAmount { get; set; }
    }
}

}

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace TrackerLibrary { /// /// Represent what the prize if for the given place. /// public class PrizeModel { /// /// The unique identifier for the prize /// public int Id { get; set; } /// /// The numeric identifier for the place(for the second place, etc.) /// public int PlaceNumber { get; set; } /// /// The friendly name for the place (second place, first runner up, etc.) ///

    public string PlaceName { get; set; }

    /// <summary>
    /// The find amount this place earns or zero if it is not used.
    /// </summary>

    public decimal PrizeAmount { get; set; }
    /// <summary>
    /// The number that represent the percentage of theoverall take or
    /// zero if it is not used. The percentage if a fraction of 1 (so O.S for
    /// 50%)
    /// </summary>

    public double PrizePercentage { get; set; }

    public PrizeModel()
    {

    }

    public PrizeModel(string placeName, string placeNumber, string placeAmount, string placePercentage)
    {
        PlaceName = PlaceName;
        int placeNumberValue = 0;
        int.TryParse(placeNumber, out placeNumberValue);
        placeNumber = placeNumberValue; //AQUI ESTA EL ERROR

        decimal prizeAmountValue = 0;
        decimal.TryParse(prizeAmount, out prizeAmountValue);
        PrizeAmount = prizeAmountValue;
    }


    public string prizeAmount { get; set; }
}

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TrackerLibrary
{
    /// <summary>
    /// Represent what the prize if for the given place.
    /// </summary>
    public class PrizeModel
    {
        /// <summary>
        /// The unique identifier for the prize
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// The numeric identifier for the place(for the second place, etc.)
        /// </summary>
        public int PlaceNumber { get; set; }
        /// <summary>
        /// The friendly name for the place (second place, first runner up, etc.)
        /// </summary>

        public string PlaceName { get; set; }

        /// <summary>
        /// The find amount this place earns or zero if it is not used.
        /// </summary>

        public decimal PrizeAmount { get; set; }
        /// <summary>
        /// The number that represent the percentage of theoverall take or
        /// zero if it is not used. The percentage if a fraction of 1 (so O.S for
        /// 50%)
        /// </summary>

        public double PrizePercentage { get; set; }

        public PrizeModel()
        {
 
        }

        public PrizeModel(string placeName, string placeNumber, string placeAmount, string placePercentage)
        {
            PlaceName = PlaceName;
            int placeNumberValue = 0;
            int.TryParse(placeNumber, out placeNumberValue);
            placeNumber = placeNumberValue; //AQUI ESTA EL ERROR

            decimal prizeAmountValue = 0;
            decimal.TryParse(prizeAmount, out prizeAmountValue);
            PrizeAmount = prizeAmountValue;
        }


        public string prizeAmount { get; set; }
    }
}
Origen Enlace
Cpp
  • 23
  • 1
  • 8

(local variable) int PlaceNumberValue Error: Cannot Implicity convert type 'int' to 'string'

Buenas noches les dejo este pequeño error no puedo convertir la variable 'PlaceNumberValue' de string a entero aqui les dejo el codigo:

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace TrackerLibrary { /// /// Represent what the prize if for the given place. /// public class PrizeModel { /// /// The unique identifier for the prize /// public int Id { get; set; } /// /// The numeric identifier for the place(for the second place, etc.) /// public int PlaceNumber { get; set; } /// /// The friendly name for the place (second place, first runner up, etc.) ///

    public string PlaceName { get; set; }

    /// <summary>
    /// The find amount this place earns or zero if it is not used.
    /// </summary>

    public decimal PrizeAmount { get; set; }
    /// <summary>
    /// The number that represent the percentage of theoverall take or
    /// zero if it is not used. The percentage if a fraction of 1 (so O.S for
    /// 50%)
    /// </summary>

    public double PrizePercentage { get; set; }

    public PrizeModel()
    {

    }

    public PrizeModel(string placeName, string placeNumber, string placeAmount, string placePercentage)
    {
        PlaceName = PlaceName;
        int placeNumberValue = 0;
        int.TryParse(placeNumber, out placeNumberValue);
        placeNumber = placeNumberValue; //AQUI ESTA EL ERROR

        decimal prizeAmountValue = 0;
        decimal.TryParse(prizeAmount, out prizeAmountValue);
        PrizeAmount = prizeAmountValue;
    }


    public string prizeAmount { get; set; }
}

}