So I'm writing some code for a website with c#.
And I've used the "is" in my if and then created a variable for output like this:
if (test is Class1 item)
{
<p>@item.title</p>
}
else if(!(test is Class1 item))
{
<p>@item.title</p>
}
So my question is, how do I create a variable from type e.g. Class2 in the second if-else?
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire