{
class Program
{
static void Main(string[] args)
{
int id = 0, stock = 0, published = 0, newstock;
double price = 0.00;
string type = " ", title = " ", author = " ";
Program inventroy = new Program();
inventroy.read_one_record(ref id, ref stock, ref published, ref price, ref type, ref title, ref author);
Console.WriteLine("Update Number In Stock");
Console.WriteLine("=======================");
Console.Write("Item ID: ");
Console.WriteLine(id);
Console.Write("Item Type: ");
Console.WriteLine(type);
Console.Write("Price: ");
Console.WriteLine(price);
Console.Write("Number In Stock: ");
Console.WriteLine(stock);
Console.Write("Title: ");
Console.WriteLine(title);
Console.Write("Author/Artist: ");
Console.WriteLine(author);
Console.Write("Published: ");
Console.WriteLine(published);
Console.WriteLine("=======================");
Console.Write("Please Enter New Stock Number: ");
string line = Console.ReadLine();
newstock = int.Parse(line);
Program writeinv = new Program();
writeinv.write_one_record(ref id, ref newstock, ref published, ref price, ref type, ref title, ref author);
}
void read_one_record(ref int id, ref int stock, ref int published, ref double price, ref string type, ref string title, ref string author)
{
StreamReader myFile = File.OpenText("Inventory.dat");
id = int.Parse(myFile.ReadLine());
stock = int.Parse(myFile.ReadLine());
published = int.Parse(myFile.ReadLine());
price = double.Parse(myFile.ReadLine());
type = myFile.ReadLine();
title = myFile.ReadLine();
author = myFile.ReadLine();
myFile.Close();
}
void write_one_record(int id, int newstock, int published, double price, string type, string title, string author)
{
StreamWriter myFile = new StreamWriter(File.OpenWrite("Inventory.dat"));
myFile.WriteLine(id);
myFile.WriteLine(newstock);
myFile.WriteLine(published);
myFile.WriteLine(price);
myFile.WriteLine(type);
myFile.WriteLine(title);
myFile.WriteLine(author);
myFile.Close();
}
}
}
Can someone compile this (or just paste code into compiler) and tell me why writeinv.write_one_record(ref id, ref newstock, ref published, ref price, ref type, ref title, ref author); says it has invalid arguments?
"The best overloaded method match for 'as2.programs.write_one_record(int, int, int, double, string, string, string)' has some invalid arguments.