小编Aim*_*ast的帖子

为什么WPF Presentation库在StringBuilder.ToString()中包装字符串?

在找到的代码PresentationCore.dll(.NET4 WPF)由ILSpy:

// MS.Internal.PresentationCore.BindUriHelper
internal static string UriToString(Uri uri)
{
    if (uri == null)
    {
        throw new ArgumentNullException("uri");
    }

    return new StringBuilder(uri.GetComponents(uri.IsAbsoluteUri ? UriComponents.AbsoluteUri : UriComponents.SerializationInfoString, UriFormat.SafeUnescaped), 2083).ToString();
}
Run Code Online (Sandbox Code Playgroud)

返回类型uri.GetComponentsstring,为什么没有方法只返回string值而不是将它包装在一个StringBuilder(string).ToString();是这个设计?在一般意义上这样做的原因是什么?它会减少分配或改善垃圾收集还是用于线程安全?

.net c# string wpf stringbuilder

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

git svn clone:在commit <sha>中找不到<file>

我正在尝试git svn clone从Codeplex的SSH.NET存储库.我的命令是:

git svn clone https://sshnet.svn.codeplex.com/svn/
Run Code Online (Sandbox Code Playgroud)

但它始终会以错误消息停止.这是我第一次遇到错误git svn clone,我不知道这个SVN存储库是如何特殊的.

我试图谷歌寻求答案,但我找到的任何东西都不适合我.我读过了:

这是错误消息:

r9445 = e8eb2162b4e5cc6b5b5129f0739c4f60cc42a58a (refs/remotes/git-svn)
        M       Renci.SshClient/Renci.SshNet/Sftp/SftpFileStream.cs
        M       Renci.SshClient/Renci.SshNet/Sftp/SftpFile.cs
        M       Renci.SshClient/Renci.SshNet/SshCommand.cs
        M       Renci.SshClient/Renci.SshNet/Shell.cs
        M       Renci.SshClient/Renci.SshNet/SftpClient.cs
        M       Renci.SshClient/Renci.SshNet/PrivateKeyFile.cs
        M       Renci.SshClient/Renci.SshNet/ConnectionInfo.cs
r9486 = 91aea22d35ad41f70fa583d262438cf00a0a117d (refs/remotes/git-svn)
        M       Renci.SshClient/Renci.SshNet/Security/Cryptography/Ciphers/RsaCi
pher.cs
        A       Renci.SshClient/Renci.SshNet/Security/Cryptography/RsaKey.cs
Renci.SshClient/Renci.SshNet/Security/Cryptography/RsaDigitalSignature.cs was no
t found in commit 91aea22d35ad41f70fa583d262438cf00a0a117d (r9486)
Run Code Online (Sandbox Code Playgroud)

svn git codeplex git-svn

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

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

如何在gitattributes中应用语言的diff规则

例如,该行的.gitattributes文件.代码的输出lg2s*.cs diff=csharp

using (var repo = new Repository(@"path\to\lg2s"))
{
    var tree1 = repo.Lookup<Commit>("a845db9").Tree;
    var tree2 = repo.Lookup<Commit>("d677741").Tree;
    var patches = repo.Diff.Compare<Patch>(tree1, tree2);
    foreach (var patch in patches)
    {
        Console.WriteLine(patch.Patch);
    }
}
Run Code Online (Sandbox Code Playgroud)

是(不久)

diff --git a/LibGit2Sharp/RepositoryStatus.cs b/LibGit2Sharp/RepositoryStatus.cs
@@ -59,8 +59,8 @@ namespace LibGit2Sharp
Run Code Online (Sandbox Code Playgroud)

但输出git bash是(很快)

diff --git a/LibGit2Sharp/RepositoryStatus.cs b/LibGit2Sharp/RepositoryStatus.cs
@@ -59,8 +59,8 @@ internal RepositoryStatus(Repository repo, StatusOptions optio
Run Code Online (Sandbox Code Playgroud)

第二行不一样.

看起来有一个深入的讨论Add .gitattributes support libgit2 /#508,但PR Add APIs for git attributes libgit2 /#516是否合并?

现在支持多少种语言? …

libgit2 libgit2sharp

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

标签 统计

libgit2sharp ×2

.net ×1

c# ×1

codeplex ×1

git ×1

git-svn ×1

libgit2 ×1

string ×1

stringbuilder ×1

svn ×1

wpf ×1