❔ how to use List that have struct type ( WPF)
public struct Linq
{
public Window win;
public TextBox textBox;
}
private void newWindow()
{
Window win = new Window();
TextBlock t = new TextBlock()
List<Linq> a = new List<Linq>();
a.Add(win, t);
}
I wanna input struct Linq (TextBlock and Window class object) to List
14 Replies
is there something that's not working with this code?
oh, right
do you know how to instantiate objects?
yea I wanna know how to use list included type struct
just like any other type
structs aren't special in this
oh actually Im cpp user so ,I just used it
you need to
new
the struct up
a.Add(new Linq { win = win });
or whatever you feel likeis it wrong? public struct Linq
{
public Window win;
public TextBox textBox;
}
no, the struct is fine (but it shouldn't really be a struct)
it is alright but Could not use pair like this
a.Add(new Linq { win = win, textBox = t });
look at your errors
and what do you think that could mean
ah
resolve ! thanks
I missed type ( textBox, textBlock)
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.