小编Can*_*der的帖子

使用Powershell访问静态类中的Static类

我有一个类如下

namespace Foo.Bar
{
    public static class ParentClass
    {
      public const string myValue = "Can get this value";

      public static class ChildClass
      {
        public const string myChildValue = "I want to get this value";
      }
     }
}
Run Code Online (Sandbox Code Playgroud)

我可以使用powershell获取myValue,

[System.Reflection.Assembly]::LoadWithPartialName("Foo.Bar")
$parentValue = [Foo.Bar.ParentClass]::myValue
Run Code Online (Sandbox Code Playgroud)

但是我无法在类myChildValue中获得该类.有人可以帮忙吗?

认为它可能类似于下面但$ childValue总是空的.

[System.Reflection.Assembly]::LoadWithPartialName("Foo.Bar")
$childValue = [Foo.Bar.ParentClass.ChildClass]::myChildValue
Run Code Online (Sandbox Code Playgroud)

powershell static class

5
推荐指数
1
解决办法
3178
查看次数

Jquery从span中删除文本

我是JQuery的新手,真的很难如何执行我想要的查询.

我正在使用SharePoint,当使用外部数据列并将其设置为必填字段时,错误消息始终显示,直到您填写数据.与其他类型的列不同,它们仅在您单击"确定"/"保存"并且未填充数据后才出现.因此,我需要从这些类型的列中删除错误消息文本.

我假设我需要在包含"外部数据"字样的.ms-error类中搜索span并隐藏它.

从使用IE开发人员工具栏,我已经确定了该区域.

 <table class="ms-usereditor" id="ctl00_m_g_05df537a_596b_443a_a11e_764069facec8_ctl00_Field_External_539c53fe_8334_43c8_b089_cc28d7895e68_Picker_OuterTable" style="border-collapse: collapse;" border="0" cellSpacing="0" cellPadding="0">
    <tbody>
     <tr>
     <td colSpan="3">
       <span class="ms-error" id="ctl00_m_g_05df537a_596b_443a_a11e_764069facec8_ctl00_Field_External_539c53fe_8334_43c8_b089_cc28d7895e68_Picker_errorLabel">
           Text - You must specify a value before using the Check button. You can also use Select button to choose External Data.
        </span>
      </td>
      </tr>
    </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

请有人帮我使用JQuery.

javascript jquery

4
推荐指数
2
解决办法
5万
查看次数

C# Task.WhenAll 处理异常

我需要有关简单 Task.WhenAll C# 代码的帮助。我同时触发了多达 50 个不同的任务,但是,其中一些调用可能会返回错误消息。

我正在尝试编写异常处理代码,以便我可以处理有效的代码(确实如此),但捕获出错的代码,以便我可以针对它们执行其他代码。

有 AggregateException,但是有没有办法查看哪个调用/输入创建了该异常?

由于严格的公司政策,我无法分享实际的代码,但示例如下:

List<ListDetails> libs = getListDetails();
var tasks = new Task<List<ItemDetails>>[libs.Count];
for (int i = 0; i < libs.Count; i++)
{
    tasks[i] = getListItems(libs[i].ServerRelativeUrl, libs[i].ListId);
}

try
{
    await Task.WhenAll(tasks);
}
catch(AggregateException aex)
{
    //Capture which Server RelativeUrls and ListIDs that failed.    
}
Run Code Online (Sandbox Code Playgroud)

c# asynchronous task

4
推荐指数
1
解决办法
6848
查看次数

标签 统计

asynchronous ×1

c# ×1

class ×1

javascript ×1

jquery ×1

powershell ×1

static ×1

task ×1