小编Win*_*Guy的帖子

如何在LINQ FindAll的StartsWith中忽略区分大小写?

我有以下代码:

ContactList = ContactList.FindAll(p => p.DeptName.StartsWith(optAlpha.SelectedItem.Value)).ToList();
Run Code Online (Sandbox Code Playgroud)

如果Daprtname ="test"和optAlpha.SelectedItem.Value = T,则它不起作用.

我尝试使用以下代码,仍然无法正常工作.

ContactList = ContactList.FindAll(p => p.DeptName.ToLower().StartsWith(optAlpha.SelectedItem.Value.ToLower())).ToList();
Run Code Online (Sandbox Code Playgroud)

c# linq

10
推荐指数
1
解决办法
5812
查看次数

如何弹出一个jquery窗口来播放youtube视频?

我需要这个视频自动播放.这将是很好的,这个代码可以播放来自其他来源的视频,如雅虎等.是否也可以使用HTML5而不是jquery?

youtube asp.net jquery html5

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

ASP.NET Web.api如何处理名称以GET开头的两个方法?

我正在查看Microsoft的以下教程.根据本教程,

在第一个示例中,"products"与名为ProductsController的控制器匹配.该请求是一个GET请求,因此框架在ProductsController上查找名称以"Get ..."开头的方法.此外,URI不包含可选的{id}段,因此框架会查找不带参数的方法.ProductsController :: GetAllProducts方法满足所有这些要求.

如果有两个方法,如GetAllProducts()和GetSoldProducts(),会发生什么?两者都没有参数.

您的第一个Web API教程

c# asp.net asp.net-mvc-4 asp.net-web-api

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

是否可以在运行时动态地将命名空间更改为ServiceContract?

例如:

[ServiceContract(Namespace = "@services.url@/",
        Name = "FedExContract")]
Run Code Online (Sandbox Code Playgroud)

我需要在运行时更改"@ services.url @"的值.

.net c# wcf

6
推荐指数
1
解决办法
3830
查看次数

BundleTable.Bundles.RegisterTemplateBundles

我有用VS2010创建的MVC4 RC项目.我不确定发生了什么,突然间我开始收到以下错误:

错误1"System.Web.Optimization.BundleCollection"不包含关于"RegisterTemplateBundles"的定义和没有扩展方法"RegisterTemplateBundles"接受类型"System.Web.Optimization.BundleCollection"的第一个参数可以找到(是否缺少使用指令或汇编引用?)C:\ xxxx\xxxx\Global.asax.cs 40 33 xxxx

错误来自Application_Start():

protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            BundleTable.Bundles.RegisterTemplateBundles();

        }
Run Code Online (Sandbox Code Playgroud)

我在Global.asax.cs文件中使用以下语句:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
Run Code Online (Sandbox Code Playgroud)

有任何想法吗????

visual-studio-2010 asp.net-mvc-4 asp.net-optimization

6
推荐指数
1
解决办法
5117
查看次数

为什么我的WSDL仍然显示基本的http绑定与http的位置值?

我启用了https绑定,但我的WSDL的SOAP地址为http.有什么想法吗?谢谢!

<wsdl:service name="XXXX"><wsdl:port name="BasicHttpBinding_XXXXService" binding="i0:BasicHttpBinding_XXXService">
    <soap:address location="http://dev-soa-app/XXXX/XXXX/XXXService.svc"/></wsdl:port>
</wsdl:service>
Run Code Online (Sandbox Code Playgroud)

这是我的web.config文件:

<?xml version="1.0"?>
<configuration>

  <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <configProtectedData>
    <providers>
      <add name="ConnStrings" type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" keyContainerName="ConnStrings" cspProviderName="" useMachineContainer="true" useOAEP="false"/>
    </providers>
  </configProtectedData>
  <connectionStrings configSource="ConnStrings\ConnStrings.config"/>
  <system.serviceModel>
    <services>
      <service name="XXXXService">
        <!-- Use a bindingNamespace to eliminate tempuri.org -->
        <endpoint address=""  name="XXXXService"
                  binding ="wsHttpBinding" bindingConfiguration="TransportSecurity"
                  bindingNamespace="WF.CT2.WebServices.XXXXService"
                  contract="WF.CT2.WebServices.XXXXService.SAMLService" />
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="TransportSecurity">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- …
Run Code Online (Sandbox Code Playgroud)

c# https wcf visual-studio-2010

6
推荐指数
1
解决办法
4751
查看次数

如何在 SignalR 中将参数传递给集线器?

我在 SignalR hub 中的代码:

public class AlertHub : Hub
{
    public static readonly System.Timers.Timer _Timer = new System.Timers.Timer();

    static AlertHub()
    {
        _Timer.Interval = 60000;
        _Timer.Elapsed += TimerElapsed;
        _Timer.Start();
    }

    static void TimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
    {
        //Random rnd = new Random();
        //int i = rnd.Next(0,2);
        Alert alert = new Alert();
        i = alert.CheckForNewAlerts(EmpId);

        var hub = GlobalHost.ConnectionManager.GetHubContext("AlertHub");

        hub.Clients.All.Alert(i);
    }
}
Run Code Online (Sandbox Code Playgroud)

不知何故,我需要传递 EmpId 参数。如何做到这一点?

更多客户详细信息: 在我的 aspx 页面上,我有以下代码:

<script type="text/javascript">

    $(function () {
        var alert = $.connection.alertHub;
        alert.client.Alert = function (msg) …
Run Code Online (Sandbox Code Playgroud)

c# signalr signalr-hub

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

Razor - 如何在div标签中显示html内容?

这是我的剃刀代码:

       <fieldset>
            <legend>Headline News</legend>

                @foreach (var item in Model)
                {
                    <div>@Html.DisplayFor(modelitem => item.Description)</div>
                }
        </fieldset>
Run Code Online (Sandbox Code Playgroud)

item.DescriptionHTML 的值是:

<table border="0" cellpadding="2" cellspacing="7" style="vertical-align:top;"><tr><td width="80" align="center" valign="top">
   {{ table info }}
</table>
Run Code Online (Sandbox Code Playgroud)

我实际上想要显示HTML内容,但它显示为HTML标记.提前致谢!

asp.net asp.net-mvc razor asp.net-mvc-3

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

迁移VB6应用程序

VB6应用程序与.NET平台的结合几乎就像重写一样,无论是VB.NET还是C#.与.NET平台相比,您是否认为在Java平台上进行此操作需要更多的努力,因为它无论如何都是重写?请分享你的想法!

c# java vb.net vb6 vb6-migration

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

SignalR hub中的Context为null

我有一个Web窗体应用程序和测试,以查看SignalR如何满足我的要求.我的中心代码:

    using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;

namespace SignalRTest.Hubs
{
    public class NotificationHub : Hub
    {
        public static readonly System.Timers.Timer _Timer = new System.Timers.Timer();


        public NotificationHub()
        {
            var myInfo = Context.QueryString["myInfo"];

            _Timer.Interval = 2000;
            _Timer.Elapsed += TimerElapsed;
            _Timer.Start();
        }

        void TimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            Random rnd = new Random();
            int i = rnd.Next(0, 2);
            var hub = GlobalHost.ConnectionManager.GetHubContext("NotificationHub");
            hub.Clients.All.Alert(i);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我的客户电话:

<script type="text/javascript">
    $(function () {
        var logger = $.connection.notificationHub;
        logger.client.Alert = function …
Run Code Online (Sandbox Code Playgroud)

c# signalr signalr-hub signalr.client

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