0
被稱爲可在此類中工作的類變量的構造函數。我如何在這個類中創建,我不能在構造函數中指定它們,但使用其他方法?如何更改類方法內的創建ref參數?
創建類:
CreatePackWindow createPackWindow = new CreatePackWindow(ref title, ref description);
if (createPackWindow.ShowDialog() == true)
{
Console.WiteLine(title, description);
}
類CreatePackWindow:
public partial class CreatePackWindow : Window
{
public CreatePackWindow(ref string title, ref string description)
{
InitializeComponent();
}
private void btnCreate_Click(object sender, RoutedEventArgs e)
{
???title = tbPackName.Text; **// How to assign here?**
???description = tbDescription.Text; **// How to assign here?**
this.DialogResult = true;
Close();
}
//..........
}
我明白,你需要創建一個指向冠軍和描述和方法與他們一起工作,但做不知道該怎麼辦:(
請幫忙。 謝謝。