无法将类型 'System.Collections.Generic.IEnumerable<string> 隐式转换为字符串

Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<string> to string

我有代码:

    public HomePage1()
    {
        InitializeComponent();
        LoadExcelFile loader = new LoadExcelFile();
        loader.ReadAndParse();            
        Title = "Home Page";
        StackLayout layout = new StackLayout();
        layout.Children.Add(new Image() { Source = "@drawable/img" });


        foreach (Block block in loader.Blocks)
        {
            switch (block.Title.ToLower())
            {
                case "hp-int":                        
                    layout.Children.Add(new Label(){Text=**block.Content**});
                    break;
                default:
                    //layout.Children.Add(new Label() { Text = block.Content });
                    break;
            }


        }

        Content = layout;

我想在标签中显示 block.content 中标题为 "hp-int" 的文本,但出现错误 "Cannot implicitly convert type 'System.Collections.Generic.IEnumerable to string"。 如果我选择标题可以正常工作,但内容...

可以帮帮我吗??谢谢

如果内容 属性 是一个字符串列表,那么您必须将它们组合成一个字符串,例如

layout.Children.Add(new Label(){Text= block.Content.Aggregate((a, b) => a + b) }); 

正如@Charles Mager 所建议的,这会表现得更好:

layout.Children.Add(new Label(){Text= string.Concat(block.Content) });