I want to check if my variable(crphoto1) is null. If crphoto1 is null, crPhoto1Data should be null and when crphoto1 is not null crPhoto1Data should be like this byte[] crPhoto1Data = File.ReadAllBytes(crphoto1);. The code belows gives me error how can I fix it?
if (string.IsNullOrEmpty(crphoto1))
{
string crPhoto1Data = "";
}
else
{
byte[] crPhoto1Data = File.ReadAllBytes(crphoto1);
}
var ph1link = "http://" + ipaddress + Constants.requestUrl + "Host=" + host + "&Database=" + database + "&Contact=" + contact + "&Request=tWyd43";
string ph1contentType = "application/json";
JObject ph1json = new JObject
{
{ "ContactID", crcontactID },
{ "Photo1", crPhoto1Data }
};