Hi all,
the code below causes "Suspicious Cast" warning. Nevertheless everything works.
if(contentRepository.TryGet<FormContainerBlock>(copyContentEventArgs.ContentLink, out var formContainerBlock))
{
var writableFormContainerBlock = formContainerBlock.CreateWritableClone() as IContent;
...
contentRepository.Save(writableFormContainerBlock, SaveAction.Publish);
}
The point is that without "as IContent" part, I could not call "Save" since it's requiring first parameter to be "IContent". And if I put "IContent" in "TryGet<>" instead of "FormContainerBlock", I then can't call "CreateWritableClone()" method.