Message 1 of 4
Parameter.AsString return value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Documentation says: Provides access to the string contents of the parameter.
Expected: When the string stored in the parameter is an empty string, I expect an empty string.
Current: When the string stored in the parameter is an empty string, the return value is a null reference.
Example: When I try to copy the contents from one parameter to another one, an empty string will be responsible of throwing an exception.
if (param1.StorageType == StorageType.String & param2.StorageType == StorageType.String)
{
param2.Set(param1.AsString());
}
It also applies to AsValueString method.
Possible workaround:
param2.Set(param1.AsString() ?? "");
Note that this workaround does not solve the inconsistency in the API.