我有一个类,因此包含一个异常.
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'动作,所以不要这样做 …
这是我现在正在做的事情
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'实用程序时 - 它会创建所有实体,我如何限制它,以便只有解决方案实体才能生成代码?
我生成一个包含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) 假设我们有'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)
我需要什么算法才能完成此任务?