[CSharpBinding] Fixed possible cast exception.