I have the following code:
var topicValue = Model.Topic;
var replaceResult = string.Empty;
if (topicValue != null & topic.Contains(topicValue)) {
}
My intent is for the if not to be executed if topicValue is null. However I am getting an error message saying:
Object reference not set to an instance of an object.
Can anyone explain how I can make this work?
Should be
EDIT:
Also, where do you initialise topic? Maybe you should check for that too and it should be