you cannot "copy" a field from sitecoll A to sitecoll B, you need to recreate it. The usual way to do this is to actually use a function that creates the search field, but this is not the case that I assume (should have been done at the beginning, in the future I suggest how you create the fields, seeing how this method is reused).
, SPSite- b sitecoll , field.SchemaXml, , sitecoll b. AddFieldAsXml SPSite.Fields, , InternalName .
,
CHeck, :
using(SPSite targetSite = new SPSite("urloftargetsite"))
{
using(SPWeb targetWeb = sourceSite.OpenWeb())
{
if(!targetWeb.Fields.ContainsField(originalField.InternalName))
{
targetWeb.Fields.AddFieldAsXml("caml string here");
}
}
}