小编Yac*_*cov的帖子

覆盖'是'功能

我有一个类,因此包含一个异常.

public class ExceptionWrapper
{
    public string TypeName { get; set; }
    public string Message { get; set; }
    public string InnerException { get; set; }
    public string StackTrace { get; set; }

    public ExceptionWrapper() { }

    public ExceptionWrapper(Exception ex)
    {
        TypeName = String.Format("{0}.{1}", ex.GetType().Namespace, ex.GetType().Name);
        Message = ex.Message;
        InnerException = ex.InnerException != null ? ex.InnerException.Message : null;
        StackTrace = ex.StackTrace;
    }

    public bool Is(Type t)
    {
        var fullName = String.Format("{0}.{1}", t.Namespace, t.Name);
        return fullName == TypeName;
    }
}
Run Code Online (Sandbox Code Playgroud)

我想覆盖'is'动作,所以不要这样做 …

c#

29
推荐指数
3
解决办法
2568
查看次数

限制CrmSvcUtil以仅创建我的解决方案所需的代码

这是我现在正在做的事情

CrmSvcUtil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization,Microsoft.Xrm.Client.CodeGeneration" /url:http://pcrm/Adzz/XRMServices/2011/Organization.svc /out:Xrm.cs /username:xxxx /password:xxxx /domain:xxxx /namespace:xxxx /serviceContextName:XrmServiceContext
Run Code Online (Sandbox Code Playgroud)

当我使用'CrmSvcUtil'实用程序时 - 它会创建所有实体,我如何限制它,以便只有解决方案实体才能生成代码?

c# dynamics-crm-2011

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

随机不好用

我生成一个包含62个选项的字符串^ 6个字母= 56,800,235,584

但是在运行代码时,它会重复相同的字符串,然后每200,200次重复一次

这里有什么问题?

顺便说一句:这段代码基于这里的答案

class Program
{
    static void Main(string[] args)
    {
        var d = new Dictionary<string, bool>();

        for (int i = 0; ; i++)
        {
            var s = GenerateString(6);
            try
            {
                d.Add(s, false);
            }
            catch (Exception ex)
            {
                Console.WriteLine(String.Format("{0} - {1} - {2}", i, s, ex.Message));
                i = 0;
            }
        }

        Console.ReadKey();
    }


    static Random _rnd = new Random();
    public static string GenerateString(int len)
    {
        const string bigLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        const string smallLetters = "abcdefghijklmnopqrstuvwxyz"; …
Run Code Online (Sandbox Code Playgroud)

c# random algorithm

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

如何在C#中获取所有可能的类组合

假设我们有'X','Y','Z',我需要的结果将是这样的

(X),(X,Y),(X,Z),(X,Y,Z),(Y),(Y,Z),(Z)
Run Code Online (Sandbox Code Playgroud)

如果我们有'X','Y','Z','J',那么我需要的结果将是这样的

(X), (X,Y),(X,Z),(X,J), (Y), (Y,Z),(Y,J), (Z),(Z,J)
(X,Y,Z), (X,Y,Z,J), (Y,Z,J), (Z,J,X)
Run Code Online (Sandbox Code Playgroud)

我需要什么算法才能完成此任务?

c# algorithm

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

标签 统计

c# ×4

algorithm ×2

dynamics-crm-2011 ×1

random ×1