小编Nic*_*ico的帖子

如何以编程方式删除Azure Active Directory用户?

我使用以下代码.代码执行正常但不删除用户.

IUser deleteuser = new User();
deleteuser = users.Where(myuser => myuse

r.MailNickname.Equals("IshanArora")).FirstOrDefault();

if (deleteuser != null)
{
    deleteuser.DeleteAsync();
}
Run Code Online (Sandbox Code Playgroud)

.net c# azure azure-active-directory

7
推荐指数
1
解决办法
1360
查看次数

在C#中,如何在变量没有线程或定时器时获取变量的值

int i = 0;

i值的变化:

i = (Atypical value)

然后

bool callback(int i)
   target = i;
   return true;
Run Code Online (Sandbox Code Playgroud)

在C#中,如何在变量时获取变量的值而不使用线程或定时器

c#

7
推荐指数
1
解决办法
111
查看次数

Web服务在SOAPAction中添加额外的正斜杠

我正在使用SoapUI来测试将由Java客户端应用程序使用的.Net Web服务.

当我将我的Web服务连接到SoapUI但更新WSDL位置并调用其中一个预设测试脚本时,Web服务失败并显示以下代码

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Client</faultcode>
         <faultstring>System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: urn:mycode:us:gu:das:supplierengagement:v02:SupplierEngagement:/AppointSupplier.
   at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
   at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean&amp; abortProcessing)    
         </faultstring>
         <detail/>
      </soap:Fault>    
   </soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

从上面的错误可以看出,问题在于SOAPAction参数有一个额外的正斜杠.

我在类上使用以下属性:

<WebService(Namespace:= "urn:mycode:us:gu:das:supplierengagement:v02:SupplierEngagement:AppointSupplier")>
Run Code Online (Sandbox Code Playgroud)

以及方法调用的以下属性:

<WebMethod(MessageName:="appointSupplierRq")>
Run Code Online (Sandbox Code Playgroud)

从这些,.Net正在添加正斜杠.

必须可以删除自动生成的正斜杠.

vb.net asp.net soap web-services soap-client

6
推荐指数
1
解决办法
1204
查看次数

关于通用try catch的建议

这不是一个问题,而是更多的反馈和想法.我一直在考虑通过内部团队彻底测试的方法的实现.我想写一个通用异常catch方法和报告服务.

我认为这并不像"try-catch"块那么容易,但允许使用统一的方法来捕获异常.理想情况下,我想执行一个方法,提供一个故障回调并记录调用方法中的所有参数.

通用尝试执行.

public class ExceptionHelper
{
     public static T TryExecute<T, TArgs>(Func<TArgs, T> Method, Func<TArgs, T> FailureCallBack, TArgs Args)
     {
            try
            {
                return Method(Args);
            }
            catch (Exception ex)
            {
                StackTrace stackTrace = new StackTrace();
                string method = "Unknown Method";
                if (stackTrace != null && stackTrace.FrameCount > 0)
                {
                    var methodInfo = stackTrace.GetFrame(1).GetMethod();
                    if (methodInfo != null)
                        method = string.Join(".", methodInfo.ReflectedType.Namespace, methodInfo.ReflectedType.Name, methodInfo.Name);
                }
                List<string> aStr = new List<string>();
                foreach (var prop in typeof(TArgs).GetProperties().Where(x => x.CanRead && x.CanWrite))
                {
                    object propVal …
Run Code Online (Sandbox Code Playgroud)

c# generics exception

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

从Windows Phone上的应用程序打开照片编辑选择器

我正在为Windows Phone开发Lens应用程序,并且一直在尝试为Photo Edit Picker找到一个API ,但到目前为止我找不到一个.根据我的猜测,在Microsoft.Phone.Tasks命名空间中打开以下屏幕似乎没有任务.

有没有办法从应用程序中打开照片编辑选取器列表,还是不支持?

在此输入图像描述

c# windows-phone windows-phone-8

5
推荐指数
0
解决办法
217
查看次数

捆绑和缩小不使用Asp.net 4.0 C#应用CSS和JS

我是这个概念的新手,这是我的第一个实现(捆绑和缩小)优化概念的项目

我只是想用简单的js和css测试

Test.aspx

<html>
<%@ import namespace="System.Web.Optimization" %>
<html>
<head runat="server">
    <%: Scripts.Render("~/bundles/js") %>
    <%: Styles.Render("~/bundles/css") %>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <button id="tests">
            testing</button>
    </div>
    </form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

Global.Asax看起来像这样

protected void Application_Start(object sender, EventArgs e)
{
    RegisterBundles(BundleTable.Bundles);
}

public static void RegisterBundles(BundleCollection bundles)
{
    bundles.Add(new ScriptBundle("~/bundles/js").Include(
     "~/script/jquery-1.8.2.min.js",
     "~/script/s.js"));

    bundles.Add(new StyleBundle("~/bundles/css").Include(
     "~/css/master.css"));

    BundleTable.EnableOptimizations = true;
}
Run Code Online (Sandbox Code Playgroud)


项目结构看起来像这样

在此处输入图片说明


浏览器视图 在此处输入图片说明

该文件是捆绑在一起的,但是在CSS中,我有某种样式可以在网页中呈现,因此没有任何显示,

样本也类似于jquery文件

有关此帖子的更多信息,请检查此。. 单击此处

你能指导我实现这一目标吗?

c# asp.net

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

如何从 Azure 总线服务检索所有主题?

我有一个包含 12 个主题的 Azure 服务总线。我正在制作一个可扩展的应用程序,如果主题数量减少或增加,应用程序应该connectionString用来获取该服务总线的所有主题名称。

如何从特定 Azure 服务总线获取所有主题名称?

请提供从特定 Azure 服务总线检索主题列表的代码示例。

c# azure azureservicebus

3
推荐指数
1
解决办法
1542
查看次数

decimal.ToString的不同行为

我遇到了一个非常奇怪的行为decimal.ToString:第一种情况: 在此输入图像描述

你可以看到那个变量ValueFloat = 9ValueFloat.Value.ToString("G") = "9".

第二种情况:

在此输入图像描述

你可以看到那个变量ValueFloat = 9ValueFloat.Value.ToString("G") = "9.000000000000000".

现在,怎么可能呢?变量ValueFloat在两种情况下都具有相同的值.

我假设它可能与文化有关,但在这两种情况下代码都在我的本地机器上运行,这显然具有相同的文化.

c# decimal tostring

3
推荐指数
1
解决办法
138
查看次数

将文件名保存为变量

有没有办法在Visual C#中保存等于变量的文件?

我正在使用一个程序来自动化MS Word文档,并希望它们以通用标题+日期保存.

以下代码行不起作用.

DateTime Tomorrow = DateTime.Now.AddDays(1);
string OKD; 
OKD = Tomorrow.ToString("MM/dd/yyyy");
document.SaveAs(FileName: @"C:\Users\Me\Desktop\Generic name "+ OKD +".doc");
Run Code Online (Sandbox Code Playgroud)

c#

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

值不能为空。参数名称:编码器

我需要截取屏幕的一部分并检查屏幕截图是否与pictureBox2.

这是行不通的:

pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
Run Code Online (Sandbox Code Playgroud)

错误是

值不能为空。
参数名称:编码器

在此处输入图片说明

我的代码如下所示:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        Bitmap screenshot = new Bitmap(SystemInformation.VirtualScreen.Width,
            SystemInformation.VirtualScreen.Height,
            PixelFormat.Format32bppArgb);
        public Form1()
        {
            InitializeComponent();

        }



        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            Bitmap screenshot = new Bitmap(SystemInformation.VirtualScreen.Width,
                SystemInformation.VirtualScreen.Height,
                PixelFormat.Format32bppArgb);
            Graphics screenGraph = Graphics.FromImage(screenshot);
            screenGraph.CopyFromScreen(
                SystemInformation.VirtualScreen.X …
Run Code Online (Sandbox Code Playgroud)

c# memorystream save-image

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

在Windows C#之间传递对象

我一直在负责一个项目,我必须使用来创建从文件中消化对象列表的表单,然后才能将列表传递到另一个窗口.

public class Food
{
    public string Name;
    public string Category;
    public int Price;
}

public class Ingredient
{
    public string Name;
    public string Category;
    public decimal PricePerUnit;
    public decimal Quantity;

    public Ingredient(string pName, string pCategory, decimal pPricePerUnit, decimal pQuantity)
    {
        Name = pName;
        Category = pCategory;
        PricePerUnit = pPricePerUnit;
        Quantity = pQuantity;
    }
}

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        List<Ingredient> Inventory = …
Run Code Online (Sandbox Code Playgroud)

c# xaml

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

SQL GROUP BY查询问题

我有一个包含以下列的表:

DriverNumber; DriverName; CarNumber; DriverConditions; LogonTime; VehicleID
Run Code Online (Sandbox Code Playgroud)

此表为每个DriverNumber的每个LogonTime都有一个条目,并且驱动程序可以登录到不同的车辆.

例如:

93070495    Mehar   189 Parcel, V, Wheelchair, M50, Special, Animal, COD P...       Jan  2 2014 07:40:26:197AM  1029
93070495    Mehar   189 Parcel, V, Wheelchair, M50, Special, Animal, COD P...       Jan  7 2014 08:09:50:097AM  1029
25184313    Kerry   895 Parcel, Cheques, V, Wheelchair, Special, Animal, C...       Jan  3 2014 05:00:26:600PM  970
Run Code Online (Sandbox Code Playgroud)

我本来想要做的是显示DriverNumber登录每辆车的次数.

这是我到目前为止所做的:

SELECT DriverNumber, DriverName, CarNumber, DriverConditions, LogonTime, 
    count(DriverNumber) as DriverCount 
FROM SilverDrivers 
WHERE DriverNumber > 0
GROUP BY CarNumber
Run Code Online (Sandbox Code Playgroud)

这让我接近我所追求的,但它只显示每个DriverNumber一个CarNumber.例如:

DRIVER HDL | …
Run Code Online (Sandbox Code Playgroud)

mysql sql

-3
推荐指数
1
解决办法
112
查看次数