Sql Linq select语句,但不需要from行

Sql Linq select语句,但不需要from行,sql,linq,Sql,Linq,因此,在Sql中,您可以不从任何数据库提取简单的行,例如 选择“hello world” Linq的等效值是多少?我想用变量代替“hello world” hello,其中包含“hello world” var helloworld = new {SayWhat = "Hello", ToWhom = "world", Name = "Bob", Surname = "Morris"}; var hello = new {SayWhat = "Bye", ToWh

因此,在Sql中,您可以不从任何数据库提取简单的行,例如
选择“hello world”

Linq的等效值是多少?我想用变量代替“hello world” hello,其中包含“hello world”

        var helloworld = new {SayWhat = "Hello", ToWhom = "world", Name = "Bob", Surname = "Morris"};
        var hello = new {SayWhat = "Bye", ToWhom = "world", Name = "Michael", Surname = "Smith"};
        var Combine = helloworld.Union(hello);

在SQL中,
SELECT
不带
FROM
用于创建一行数据。在LINQ中实现相同效果的一种方法是使用,如下所示:

var hello = "Hello, world!";
IEnumerable<string> noFromLinq = Enumerable.Repeat(hello, 1);

var hello=“hello world”相信我,没有数据库呼叫是不是linq?别这么认为,相信我。我该如何在其中添加额外的列?抱歉,我以前没有见过这种语法。是否可以将该行与另一行合并?@user2785177是的,只要另一行具有完全相同的字段列表,包括其名称和类型的大小写。
IEnumerable<string> noFromArray = new[] { hello };
var helloMultipleColumns = new { SayWhat = "Hello", ToWhom = "world"};
var noFromMulticolumnLinq = Enumerable.Repeat(helloMultipleColumns, 1);
var noFromMulticolumnArray = new[] { helloMultipleColumns };