Given that the System.ServiceModel.Channels.Binding class in WCF does not have a Clone method, what is an efficient way of making a complete, deep copy of a Binding, without writing out all the possible properties by hand?
Given that the System.ServiceModel.Channels.Binding class in WCF does not have a Clone method, what
Share
If you don’t mind treating everything as a
CustomBinding, you could do this:This works because all of the system-provided bindings are equivalent to a
CustomBindingwith the binding elements pre-configured. Cloning the binding this way means that you don’t have to know the type of the binding in advance, and you certainly don’t have to spend a day typing out every possible property of theBindingtypes you need.