Model.ProductInfo.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
        public override string ToString()
        {
            string s = "Navne: " + name + ";" + "Type: " + type;
            for (int i = 0; i < sizeCost.Length/2; i++)
            {
                s = s + ";" + "Størrelse: " + sizeCost[i, 0].ToString() + "g, Prise: " + sizeCost[i, 1].ToString() + "kr";
            }
            s = s + ";" + CalculateProductionPrice();
            return s;            
        }
    }

Usage Example

示例#1
0
        public string ShowProductDocumation(string pName, string pType, string pDocumation)
        {
            if (pNameList.Contains(pName) && pTypeList.Contains(pType) && pDocumationList.Contains(pDocumation))
            {
                if (pDocumation == "Produkt infomation")
                {
                    ProductInfo pi = new ProductInfo(pName, pType);
                    return pi.ToString();
                }
                else if (pDocumation == "Opskirft")
                {
                    Recipe r = new Recipe(pName, pType);
                    return r.ToString();
                }
                else if (pDocumation == "Correspondance")
                {

                }
                else if (pDocumation == "QualityAssurance")
                {

                }
                //database metode til at give data tilbage i en string
            }
            return null;
        }