我正在使用正则表达式来检查子网掩码.我使用带有屏蔽值的ajax txtbox,但这不起作用,然后我切换到文本框并为其应用正则表达式.不幸的是,一个人也没有工作.
你能帮助我为子网屏蔽255.255.255.255提供RE吗?
或者最好的方法呢?
方案:
我使用蒙面文本框,不知道如何放置验证表达式.
最后,我发现了一个蒙版文本框的属性作为验证表达式,然后我把RE和属性validate更改为true.
无需显式使用验证器表达式.
谢谢
这可能是一个非常简单的问题,但我从未接触过delphi.我有一个编辑框,可以接受角色.但在某些特殊情况下,我必须验证编辑框字符只是数字.
我们怎么做?
注意:用户可以输入任何char,但在验证时我必须验证上面的一个.
有一个方法返回 2D 数组,该方法从 LINQ 查询查询字典并尝试在 2D 数组中存储键和值。
但我无法做到这一点
public string[][] GetRecordFields(string selectedRecord)
{
var recordFields = (from record in _recordMasterList
where record.Item1 == selectedRecord
select new
{
record.Item2.Keys,
record.Item2.Values
}).ToArray();
return recordFields;
}
Run Code Online (Sandbox Code Playgroud)
但是失败了,有什么办法吗?
编辑:类型_recordMasterList
List<Tuple<string, Dictionary<string, string>>> _recordMasterList;
Run Code Online (Sandbox Code Playgroud) 我使用的是Visual Studio Express Edition,它没有任何分析器或代码分析器.
代码有两个委托执行相同的任务,一个使用匿名方法,另一个通过Lambda表达式.我想比较哪一个花费更少的时间.
我怎样才能在VS express中做到这一点?(不仅是方法的代表也)
如果是重复,请链接.
谢谢
我试过像这样:
/** Start Date time**/
DateTime startTime = DateTime.Now;
/********do the square of a number by using LAMBDA EXPRESSIONS********/
returnSqr myDel = x => x * x;
Console.WriteLine("By Lambda Expression Square of {0} is: {1}", a,myDel(a));
/** Stop Date time**/
DateTime stopTime = DateTime.Now;
TimeSpan duration = stopTime - startTime;
Console.WriteLine("Execution time 1:" + duration.Milliseconds);
/** Start Date time**/
DateTime startTime2 = DateTime.Now;
/*****do the square of a number by using …Run Code Online (Sandbox Code Playgroud) 为什么x86文件夹存在于c Sharp项目文件的obj文件夹中?
我的项目文件结构是
ProjectOne
---------- Bin
-------------- Debug
-------------- Release
-------- --Obj
-------------- x86 //为什么这样?
-------------------调试
-------------------释放
-----我的源文件.
为什么我的文件当前目录是bin\debug,而不是projectOne(我的源文件存在)?
我开始学习Web服务.我学习了Web服务,UDDI,WSDL,SOAP等以及Web服务的体系结构.Visual Studio正在本地系统中成功运行该服务.
然后我在IIS wwwroot中部署了该Web服务的整个文件夹,并进行了测试.它运行成功.
但是当我从wwwroot\webService1文件夹中删除其他文件时(我只留下了service1.asmx和bin文件夹),那么服务也在运行.
在这里我看到,只有两个文件在ruuning web服务之一是使用的.asmx,另一个是webService.dll在仓文件夹中.
我无法理解运行Web服务所需的SOAP,WSDL,命名空间或其他内容.
请澄清.
我为我的项目方法创建了一个单元测试.当找不到文件时,该方法引发异常.我为此编写了一个单元测试,但是在引发异常时我仍然无法通过测试.
方法是
public string[] GetBuildMachineNames(string path)
{
string[] machineNames = null;
XDocument doc = XDocument.Load(path);
foreach (XElement child in doc.Root.Elements("buildMachines"))
{
int i = 0;
XAttribute attribute = child.Attribute("machine");
machineNames[i] = attribute.Value;
}
return machineNames;
}
Run Code Online (Sandbox Code Playgroud)
单元测试
[TestMethod]
[DeploymentItem("TestData\\BuildMachineNoNames.xml")]
[ExpectedException(typeof(FileNotFoundException),"Raise exception when file not found")]
public void VerifyBuildMachineNamesIfFileNotPresent()
{
var configReaderNoFile = new ConfigReader();
var names = configReaderNoFile.GetBuildMachineNames("BuildMachineNoNames.xml");
}
Run Code Online (Sandbox Code Playgroud)
我应该处理方法中的异常还是我错过了其他的东西?
编辑:
我传递的路径不是找到文件的路径,所以这个测试应该通过...即如果文件不存在于该路径中该怎么办.
我是一名实习软件工程师,我做了关于收集和仿制的自学,并向我的TL报告.他建议我也研究这些东西.
特别是在泛型中如何为泛型类型定义内存,IL和CLR如何用于泛型?
通用过度收集或拳击拆箱的性能?
我用谷歌搜索,但得到了限制的答案.可以请任何人解释或提供任何事项(链接)上学习.
谢谢.
我没有使用任何线程池.只是创建ThreadArray.for循环创建线程但同时主线程继续....如何在主线程上应用wait,直到for循环创建的所有线程都没有完成.
码:
public List<DirInfo> ScanDir()
{
for (int i = 0; i < 5; i++)
{
threadArray[i] = new Thread(delegate()
{
StartScanning(paths);
}
);
threadArray[i].Start();
}
....
List<DirInfo> listInfo = new List<DirInfo>();
...
...
....
return listInfo
}
Run Code Online (Sandbox Code Playgroud)
码:
public List<ServerDataInformation> ScanParallel()
{
var appConfigData = ReadAppConfig();
if (appConfigData == null)
{
EventPublisher.NotifyApplication("Error in appconfig File");
return null;
}
int pathCount = appConfigData.Length;
string serverPath;
string serverName;
var waitHandles = new WaitHandle[pathCount];
Thread[] threadArray = new Thread[pathCount];
for (int i …Run Code Online (Sandbox Code Playgroud) var param = Expression.Parameter(typeof(Employee), "t");
MemberExpression member = Expression.Property(param, "EmployeeName");
var value = Convert.ChangeType(filterProperty.Value, member.Type);
ConstantExpression constant = Expression.Constant(value);
var body = Expression.Or(leftExpr, Expression.Equal(member, constant));
Run Code Online (Sandbox Code Playgroud)
我可以轻松获取正常属性的表达式,但是如何获取索引器属性的表达式?
在Employee课堂上我有两个索引器.
class Employee
{
public string EmployeeName {get;set;}
public string this[EmployeeTypes empType]
{
get
{
return GetEmployee(empType);
}
}
public string this[int empNum]
{
get
{
return GetEmployee(empNum);
}
}
}
Run Code Online (Sandbox Code Playgroud) c# ×9
asp.net ×3
linq ×2
.net ×1
arrays ×1
delphi ×1
delphi-5 ×1
performance ×1
soap ×1
unit-testing ×1
web-services ×1
wsdl ×1