小编Jos*_*wry的帖子

使用正则表达式在C#中使用转义引号查找带引号的字符串

我试图在一行中找到所有引用的文本.

例:

"Some Text"
"Some more Text"
"Even more text about \"this text\""
Run Code Online (Sandbox Code Playgroud)

我需要得到:

  • "Some Text"
  • "Some more Text"
  • "Even more text about \"this text\""

\"[^\"\r]*\" 除了最后一个之外,它给了我所有的东西,因为有报道.

我已阅读有关\"[^\"\\]*(?:\\.[^\"\\]*)*\"工作的信息,但在运行时遇到错误:

parsing ""[^"\]*(?:\.[^"\]*)*"" - Unterminated [] set.
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

c# regex quotes escaping

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

在没有Visual Studio的情况下使用TFS

工作区设置中是否有一些设置允许您编辑文件,并让TFS确定已更改的内容?

我正在使用我们想要签入的Matlab代码,但由于我们不使用Visual Studio,因此它使工作变得复杂.(签出我们要编辑的每个文件).

也许像Subversion,但我们没有选择使用其他源控制系统.

svn tfs tfs2013

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

具有验证和间接的C#Excel依赖选项列表

以下是从C#动态创建依赖选项列表的一般尝试.当从pick1中选择值'A'时,pick2应该显示来自SecondaryRangeA的值.

此代码几乎可以工作,但它不显示SecondaryRangeA,而是显示文字值"A".

pick2.Validation.Add(XlDVType.xlValidateList, 
                     XlDVAlertStyle.xlValidAlertStop, 
                     XlFormatConditionOperator.xlBetween, 
                     "=INDIRECT(\"A5\")");
Run Code Online (Sandbox Code Playgroud)

当我在导出和修改数据验证后打开excel时,它会显示公式.

=INDIRECT("A5")
Run Code Online (Sandbox Code Playgroud)

如果我在Excel中手动修改公式以排除引号,它按预期工作.

=INDIRECT(A5)
Run Code Online (Sandbox Code Playgroud)

当我将代码修改为以下内容时,我得到一个例外.有任何想法吗?

pick2.Validation.Add(XlDVType.xlValidateList, 
                     XlDVAlertStyle.xlValidAlertStop, 
                     XlFormatConditionOperator.xlBetween, 
                     "=INDIRECT(A5)");
Run Code Online (Sandbox Code Playgroud)

例外:

System.Runtime.InteropServices.COMException was unhandled
  ErrorCode=-2146827284
  Message=Exception from HRESULT: 0x800A03EC
Source=""


StackTrace:
   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
   at Microsoft.Office.Interop.Excel.Validation.Add(XlDVType Type, Object AlertStyle, Object Operator, Object Formula1, Object Formula2)
   at TestExcelValidation.Program.Main(String[] args) in C:\TFS\ExcelInterop\TestExcelValidation\Program.cs:line 44
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
Run Code Online (Sandbox Code Playgroud)

完整示例:

using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Office.Interop.Excel; …
Run Code Online (Sandbox Code Playgroud)

.net c# excel excel-indirect

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

如何处理我的代码未引用但需要在bin中的依赖项DLL?

我正在为第三方应用程序开发一系列插件,供应商为我们提供了所有插件程序集以及一些帮助程序组件以便与他们的系统一起工作.

我们的代码通常引用这些帮助程序集,但是它们的插件程序集仍然需要复制到外部bin/debug或bin/release目录.通常我会在主项目上做一个post-build事件,但由于这个项目是具有各自依赖项的单个项目的集合,我不知道该怎么做.

在Visual Studio中处理这种情况的一些建议(或最佳实践)是什么?

.net c# visual-studio external-assemblies

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

为什么这用C编译而不是C++(sigaction)?

尝试使用g ++编译下面的代码时出现以下错误.当我使用gcc编译它时它工作正常(除了一些警告).任何帮助赞赏.

g++ ush7.cpp
ush7.cpp: In function ‘int signalsetup(sigaction*, sigset_t*, void (*)(int))’:
ush7.cpp:93: error: expected unqualified-id before ‘catch’
ush7.cpp:95: error: expected primary-expression before ‘catch’
ush7.cpp:95: error: expected `;' before ‘catch’
ush7.cpp:97: error: expected primary-expression before ‘catch’
ush7.cpp:97: error: expected `;' before ‘catch’
ush7.cpp:100: error: expected primary-expression before ‘catch’
ush7.cpp:100: error: expected `)' before ‘catch’
ush7.cpp:108: error: expected `)' before ‘;’ token
ush7.cpp:108: error: expected `)' before ‘;’ token
ush7.cpp: In function ‘int makeargv(const char*, const char*, char***)’:
ush7.cpp:137: error: invalid …
Run Code Online (Sandbox Code Playgroud)

c c++ g++

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

与 C++ 相比,将 CPLEX 与 C#.NET 结合使用的效率如何?

假设我们的 UI 必须采用 C#.NET...

与 C#.NET API 相比,使用 C++ API for CPLEX 是否会影响性能?我想知道,因为如果可能的话,我希望避免跨越托管/非托管边界,但我想更多地了解 C#.NET API 的情况。

C#.NET 是否只是实现了 C++ 的托管/非托管边界?它做得好吗?

.net c# c++ cplex

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

标签 统计

c# ×4

.net ×3

c++ ×2

c ×1

cplex ×1

escaping ×1

excel ×1

excel-indirect ×1

external-assemblies ×1

g++ ×1

quotes ×1

regex ×1

svn ×1

tfs ×1

tfs2013 ×1

visual-studio ×1