小编And*_*yMM的帖子

::在C#中的目的是什么?

::在生成的代码中看到了双冒号().我想知道它的目的是什么?

c# syntax

38
推荐指数
2
解决办法
9448
查看次数

改善绩效反思 - 我应该考虑哪些替代方案?

我需要动态设置对象上的值或属性的值,称之为传输对象.

将会创建相当数量的这些传输对象,并在短时间内设置其属性.我想避免使用反射.

还有替代品吗?如果是这样的样本实现我可以看一下?

.net c# reflection performance

19
推荐指数
3
解决办法
2万
查看次数

监视队列的最有效方法

什么是监控队列的最有效方法.

以下代码是最大的资源:

/// <summary>
/// Starts the service.
/// </summary>
private void StartService()
{
    while (true)
    {
        //the check on count is not thread safe
        while (_MessageQueue.Count > 0)
        {
            Common.IMessage message;
            // the call to GetMessageFromQueue is thread safe
            if (_MessageQueue.GetMessageFromQueue(out message) == true)
            {
                if (message.RoutingInfo == Devices.Common.MessageRoutingInfo.ToDevice)
                {
                    _Port.SerialPort.WriteLine(message.Message);
                }
                if (message.RoutingInfo == Devices.Common.MessageRoutingInfo.FromDevice)
                {
                    OnDeviceMessageReceived(new Common.DeviceMessageArgs(message.Message));
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Start Service在后台线程上运行,对_MessageQueue.Count的调用不是线程安全的,我没有锁定MessageQueue中的count.但是我确实锁定了_MessageQueue.GetMessageFromQueue的实现.我这样做有效吗?我是否应该提高事件每次队列从0到大于0?

.net c# performance

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

在winforms应用程序中使用ASP.NET成员资格提供程序是个坏主意吗?

任何人都可以想到在winforms应用程序中不使用ASP.NET成员资格提供程序的原因吗?

有没有人有这方面的经验?

.net winforms

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

标签 统计

.net ×3

c# ×3

performance ×2

reflection ×1

syntax ×1

winforms ×1