这是使用C#和.net 3.5
假设我有以下方法:
myMethod(myBaseClass mbc)
Run Code Online (Sandbox Code Playgroud)
在我的项目中,以下所有类都继承自myBaseClass.
ot1:myBaseClass
ot2:myBaseClass
ot3:myBaseClass
ot4:myBaseClass
Run Code Online (Sandbox Code Playgroud)
是否有任何技巧可以让我使用myTethod与ot1和ot3,但不是ot2和ot4,或者我基本上必须为我想要允许的每种类型重载?
我的项目有一个netTCP WCF服务.这是它的app.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IIndexer" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://mach1:9000/Indexer" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IIndexer" contract="in.IIndexer"
name="NetTcpBinding_IIndexer" />
</client>
</system.serviceModel>
</configuration>
Run Code Online (Sandbox Code Playgroud)
是否有任何可以做的事情来最大限度地压缩通过线路发送的数据?我的项目是内部的,因此速度和处理能力基本上没有问题.
压缩从客户端发送到WCF服务的数据有哪些好的提示和技巧?
如何使用IndexSearcher以便它不会锁定索引并以只读模式打开它?
现在我就是
var searcher = new IndexSearcher(LuceneIndexPath);
Run Code Online (Sandbox Code Playgroud)
我一直在阅读以只读模式打开性能提升性能,所以我想知道如何去做.我找不到关于这个主题的大量文档.
我们正在使用LINQ to EF来开发解决方案.
在我的LINQ查询中,我想
string toMatch = "Matt Cool";
newString = toMatch.Replace(" ", "% ") + "%";
// So here newString is 'Matt% Cool%'
/*Now in my datasource, there is no 'Matt Cool', there's 'Matthew Coolguy'.
I would like this query to return that result.
I would expect this behavior with the
wildcard. It doesn't work*/
var results = from a in mycontainer.users
where a.fullname.equals(newString)
select a.fullname;
Run Code Online (Sandbox Code Playgroud)
我尝试使用"*"作为通配符和正则表达式解决方案,但无济于事 - 还有其他选择吗?
让我说我有
int a()
{
/* Tons of code
....*/
return someInt;
}
void main()
{
/* Tons of code
....*/
int k = a();
/* Tons of code
....*/
}
Run Code Online (Sandbox Code Playgroud)
接下来,让我假装我一次调试一步,即将进入
int k = a();
Run Code Online (Sandbox Code Playgroud)
声明,但我只是希望它执行而不是手动单步执行().有什么我可以做而不是F11所以它执行直到方法中的下一个语句.
现在我在调用a()之后设置了断点,但我认为可能有更好的方法.
我有一个系统,可以每天数百次以编程方式生成电子邮件.它们将在outlook中打开,我知道它将以不同于IE的方式呈现HTML并禁用脚本.但是,是否有任何即将推出的标准可以让人们使用JavaScript发送他们的HTML电子邮件?
是否总是存在巨大的安全风险?对于像gmail这样的客户端,没有办法将所有JS操作限制在消息体内吗?总是风险太大?Office 2010的未来版本如何?
我有一个ascx控件绑定到具有频繁更改数据的数据源.是否有一种快速方法可以每隔X秒重新启动一次ascx控制回发,重新绑定和刷新.ascx控件位于更新面板中.
ASP.NET页面控件在页面回发时刷新 - 但我不希望它.
在我的aspx中,我有:
<asp:Panel runat="server" ID="PanelRight" CssClass="roadmapRight">
<asp:Chart ID="ChartRemainingDaysHistory" runat="server">
<Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartAreaLineGraph">
<AxisY Title="Days Remaining" />
<AxisX Title="Date" IsLabelAutoFit="True">
<LabelStyle Angle="90" Interval="2" />
</AxisX>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
</asp:Panel>
Run Code Online (Sandbox Code Playgroud)
在后面的代码中:
protected void Page_Load(object sender, EventArgs e)
{
/* A bunch of code that needs to run */
if(IsPostback) return; // return if it is postback
// On first run build the graph
IQueryable<int> _users =
(metaPlanningDataContext.TasksCurrents.Where(....)).Distinct();
var s = new Series {
ChartType = SeriesChartType.Area,
Legend = …Run Code Online (Sandbox Code Playgroud) 如何在 C# 中生成继承图?我在这个项目中有很多课程,它会很有用。
编辑:我有VS2008
在C#中使用Directory.GetFiles(),有没有办法在找到文件时启动线程?
行为似乎是"找到所有文件"然后在每个文件上执行您需要的操作.是否有另一个类允许一个人在找到文件时启动线程(达到一定数量)?
c# ×5
.net ×4
asp.net ×2
javascript ×2
.net-3.5 ×1
ajax ×1
ascx ×1
asp.net-ajax ×1
debugging ×1
email-client ×1
filesystems ×1
inheritance ×1
lucene.net ×1
postback ×1
subtype ×1
timer ×1
wcf ×1
wildcard ×1