指在这个类期间可以分配工作的类变量的构造函数。我如何在这个类中进行,我不能在构造函数中将它们分配给它们,而是在不同的方法中?
创建类:
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();
}
//..........
}
我知道您需要创建指向标题和描述的指针以及使用它们的方法,但不知道该怎么做:(
请帮忙。谢谢你。