C# Blazor Web程序集字符串数组存在问题
希望有人能帮我。在Blazor Web程序集中,字符串数组的形式似乎与Blazor服务器不同。Blazor服务器中的字符串数组声明与预期一致 声明:C# Blazor Web程序集字符串数组存在问题,c#,.net-core,blazor,blazor-server-side,blazor-webassembly,C#,.net Core,Blazor,Blazor Server Side,Blazor Webassembly,希望有人能帮我。在Blazor Web程序集中,字符串数组的形式似乎与Blazor服务器不同。Blazor服务器中的字符串数组声明与预期一致 声明: string[] scopeDefault = new string[] { "myString" }; 调试值: {string[1]} 现在与Blazor Web部件进行比较: 声明(相同) 调试值(wasm) 请注意,数组的构造不同,服务器版本没有长度属性。我在一个需要iEnumerable接口的函数中使用它。当我
string[] scopeDefault = new string[] { "myString" };
调试值:
{string[1]}
现在与Blazor Web部件进行比较:
声明(相同)
调试值(wasm)
请注意,数组的构造不同,服务器版本没有长度属性。我在一个需要iEnumerable接口的函数中使用它。当我尝试在Blazor服务器中使用字符串数组时,一切正常。在WASM中,它与“无法评估儿童”分开。我试着建立一个列表和同样的问题。
以下是完整的代码,包括使用:
AuthenticationResult result = null;
try
{
string[] scopeDefault = new string[] { "MyString" };
result = await app.AcquireTokenForClient(scopeDefault).ExecuteAsync();
}
catch(Exception ex)
{
throw new Exception(ex.Message);
}
我一定错过了什么。有什么线索吗?
谢谢
Phil你能把你“尝试并使用”字符串数组的代码包括进来吗?这是真正重要的部分;请尝试{string[]scopeDefault=newstring[]{“MyString”};result=wait app.AcquireTokenForClient(scopeDefault).ExecuteAsync();}catch(Exception ex){throw new Exception(ex.Message);}```@MisterMagoo道歉-我是StackOverflow新手,无法使代码块的内联格式正常工作。我已经修改了原始帖子,使其更具可读性。这太好了-我认为问题不在于字符串[]-这是Microsoft.Identity.Web吗?我不会帮你的,因为我没用过。
string[](1)
AuthenticationResult result = null;
try
{
string[] scopeDefault = new string[] { "MyString" };
result = await app.AcquireTokenForClient(scopeDefault).ExecuteAsync();
}
catch(Exception ex)
{
throw new Exception(ex.Message);
}