I have third party api's which require string values to be submitted as empty strings. On an asp.net page I can use this code (abbreviated here) and it works fine:
public class Customer
{
private string addr1 = "";
public string Addr1
{
get {return addr1;}
set {addr1 = value;}
}
private string addr2 = "";
public string Addr2
{
get {return addr2;}
set {addr2 = value;}
}
private string city = "";
public string City
{
get {return city;}
set {city = value;}
}
}
Customer cust = new Customer();
cust.Addr1 = "1 Main St.";
cust.City = "Hartford";
int custno = CustomerController.InsertCustomer(cust);
The Addr2 field, which was not initialized is still an empty string when inserted.
However, using the same code but called it through a web service based on Windows Communication Foundation the Addr2 field is null. Is there a way (or setting) where all string fields, even if uninitialized, would return an empty string (unless, of course, a value was set).