I have this object which I don't know how I should fill it.
public class RequestGuia
{
public Ite[] ite { get; set; }
}
public class Ite
{
public string numIte { get; set; }
public int canFis { get; set; }
public string natMer { get; set; }
}
I am trying something like this:
RequestGuia rq = new RequestGuia
{
ite = new Ite
{
numIte = "",
canFis = 0,
natMer = ""
}
}
Error: Cannot implicitly convert type Ite to Ite[].
Does anyone have an idea how I should send that data? Thank you.
You are almost! What's happening is that you're trying to pass an object to the ite property inside your RequestGuia class , which is an array of the Ite class itself; To make it easier to understand, you're trying to only include Cristiano Ronaldo to play a game, when it should be the whole team (although CR probably can on his own, but that's another topic ha!) ;)
That said, it just needs to be tweaked a bit to the way you're trying to include the Ite object to the RequestGuia class .
To add objects to a list you must pass the object as a parameter (the example I included) or by calling the Add() method of the class
List
:D