I have the following class:
public class SubStredisko
{
public string Name { get; set; }
public string Code { get; set; }
public VyplatnePasky VyplatnaPaska { get; set; }
public MzdoveNaklady MzdoveNaklady { get; set; }
public Poistne Poistne { get; set; }
}
then I have two SubStredisko
items, where one of them is definitely null
. What I am trying to do, is that I have a separate method, which does some processing with SubStredisko
, such as changes values of VyplatnaPaska
etc. Here is what it looks like:
private static void VyplatnePasky_Items(ref Stredisko stredisko, XElement myElement)
{
//some logic here
}
What I try to do now (what I have problem with) is to call this method using the ?:
operator in the following way:
VyplatnePasky_Items((sPracovisko == null) ? ref sPracovisko_Dohodari : ref sPracovisko,xElement);
However it highlights sPracovisko_Dohodari
and sPracovisko
with the following error: Syntax error, ':' expected
.
I tried to put them in brackets separately, however with no luck. What am I doing wrong?
P.S. sPracovisko
and sPracovisko_Dohodari
are of type SubStredisko
.
P.S.2: Just a quick thought - maybe I don't even need a ref
parameter in here? I am not quite sure if in this case a new object will be created, or I will be (in my void) directly changing values of that specific object.