小编Lam*_*fif的帖子

全屏wpf

我正在开发一个将在全屏显示的WPF应用程序.此外,该应用程序将在许多尺寸的平板电脑中使用.我认为我的应用程序在其全尺寸上独立运行.

完成此任务的最佳做法是什么?

c# wpf xaml fullscreen

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

List,IList和IEnumerable之间的比较

我有一个C#应用程序,我在其中处理一些集合类型.我需要知道这些类型之间的区别:

  1. List
  2. IList
  3. IEnumerable

与其他人相比,每个人的优势是什么?

.net c#

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

Object,Dynamic和Var之间的区别

我需要知道这三个关键字之间的差异Object,Dynamicvar在C#.

我看过这个链接,但我不明白在哪种情况下我必须使用每一个.

你能解释一下这些关键词之间的区别吗?每个关键字的效用是什么?

c# var dynamic object

35
推荐指数
5
解决办法
4万
查看次数

EF6中的Eager,Lazy和显式加载

我已经阅读了本教程本文,但我并不完全理解每种加载类型的用法.

我解释

我有这个POCO:

public partial class dpc_gestion
{
    public dpc_gestion()
    {
        this.ass_reunion_participant = new HashSet<ass_reunion_participant>();
        this.dpc_participant = new HashSet<dpc_participant>();
        this.dpc_reunion = new HashSet<dpc_reunion>();
    }

    public int dpc_id_pk { get; set; }
    public Nullable<int> dpc_id_gdp_fk { get; set; }
    public Nullable<int> dpc_id_theme { get; set; }
    public int dpc_id_animateur_fk { get; set; }
    public Nullable<System.DateTime> dpc_date_creation { get; set; }
    public Nullable<System.DateTime> dpc_date_fin { get; set; }
    public Nullable<System.DateTime> dpc_date_engag_anim { get; set; }
    public Nullable<bool> dpc_flg_let_engag_anim …
Run Code Online (Sandbox Code Playgroud)

c# orm entity-framework lazy-loading entity-framework-6

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

找不到RedirectToLocal

我有这个代码:

using Solutionsecurity.web.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace Solutionsecurity.web.Controllers
{
    public class HomeController : Controller
    {


        public ActionResult Login() { 
        return View(new User());
        }

        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public ActionResult Login(User u, string ReturnUrl) {

            if (Membership.ValidateUser(u.login, u.password))
            {
                return RedirectToLocal(ReturnUrl);
            }
            else {
                return View(u);
            }
        }

         [Authorize]
        public ActionResult Common()
        {
            return View();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我不知道为什么RedirectToLocal没找到!!! 在这一行:

return RedirectToLocal(ReturnUrl);
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

.net c# asp.net asp.net-mvc razor

20
推荐指数
1
解决办法
8133
查看次数

Angularjs $ http POST请求空数组

以下$http request执行成功,但另一端的PHP脚本在$_POST收到'test'和'testval'时会收到一个空数组.有任何想法吗?

$http({
    url: 'backend.php',
    method: "POST",
    data: {'test': 'testval'},
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
    }).success(function (data, status, headers, config) {
    console.log(data);

    }).error(function (data, status, headers, config) {});
Run Code Online (Sandbox Code Playgroud)

javascript php angularjs

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

我不能插入基本的HTML空格而不会收到错误.还有其他方法吗?

每当我尝试使用&nsbp时,我都会使用spring,js和其他技术实现.对于空白区域,它给我以下错误:

引起:org.apache.jasper.JasperException:/WEB-INF/views/entrada/list.jspx(94,67)引用了实体"nbsp",但没有声明.

at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
    at org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:216)
    at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:239)
    at org.apache.jasper.compiler.ParserController.parseDirectives(ParserController.java:120)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:165)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
    at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
    at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:650)
    at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:644)
    at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:103)
    ... 106 more
Run Code Online (Sandbox Code Playgroud)

我的代码:

</td>
        <td>
            <c:forEach items="${entrada.tags}" var="tag">
            <spring:url value="/find/ByTags?tags=${tag.id}" var="buscarTag"/>
                <a href="${buscarTag}">${tag}</a> &nbsp;
            </c:forEach>
        </td>
         <td><input type="hidden" class="horasIn" value="${entrada.horas}"/>
         ${fn:substring(entrada.horas, 0, 10)}
         <c:set var="totalHoras" value="${totalHoras+ entrada.horas }"></c:set>bs
Run Code Online (Sandbox Code Playgroud)

html whitespace apache-tiles

13
推荐指数
1
解决办法
7872
查看次数

在C#中枚举Windows便携设备

我试图使用Windows Portable Devices API和此API提供的PortableDeviceManager在Windows上枚举连接的便携式设备.

我已经在MSDN文档链接和各种博客链接之后实现了设备ID的枚举,但它们都导致了同样的问题 - 我只能在有几个连接的时候给我一个设备的ID .

这是我正在使用的C#代码片段:

PortableDeviceManagerClass deviceManager = new PortableDeviceManagerClass();
deviceManager.RefreshDeviceList();  

uint numberOfDevices = 1;            
deviceManager.GetDevices(null, ref numberOfDevices);

if (numberOfDevices == 0)
{
    return new string[0];
}

string [] deviceIds = new string[numberOfDevices];
deviceManager.GetDevices(ref deviceIds[0], ref numberOfDevices);

return deviceIds;
Run Code Online (Sandbox Code Playgroud)

我有两台设备连接到我的电脑,一台可拆卸USB记忆棒和一台数码相机.当两者都处于活动状态时,将仅返回我的相机的设备ID.当我关闭相机时,将返回可移动USB记忆棒的设备ID.

是否有任何有此API经验的人可以指出我做错的方向?

.net c# wpd

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

在asp.net mvc中更改会话变量超时的默认值

我有一个带有razor视图引擎的Asp.net Mvc应用程序,其中我使用了一个变量Session['user']:当用户登录应用程序时Session['user'] = login,在注销时此变量取值Null.

问题是有一个短暂的超时和会话变量到期:如果我在Session['user'] =null自动登录应用程序后一分钟内什么都不做.

那么如何才能将会话变量的超时设置为无限制,直到它被程序更改为止?有什么建议吗?

.net c# asp.net asp.net-mvc razor

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

使用Gzip压缩/解压缩一个字节数组

我需要压缩一个字节数组.所以我写了这个片段:

 class Program
    {
        static void Main()
        {
            var test = "foo bar baz";

            var compressed = Compress(Encoding.UTF8.GetBytes(test));
            var decompressed = Decompress(compressed);
            Console.WriteLine("size of initial table = " + test.Length);
            Console.WriteLine("size of compressed table = " + compressed.Length);
            Console.WriteLine("size of  decompressed table = " + decompressed.Length);
            Console.WriteLine(Encoding.UTF8.GetString(decompressed));
            Console.ReadKey();
        }

        static byte[] Compress(byte[] data)
        {
            using (var compressedStream = new MemoryStream())
            using (var zipStream = new GZipStream(compressedStream, CompressionMode.Compress))
            {
                zipStream.Write(data, 0, data.Length);
                zipStream.Close();
                return compressedStream.ToArray();
            }
        }

        static byte[] Decompress(byte[] data) …
Run Code Online (Sandbox Code Playgroud)

.net c# arrays byte gzip

12
推荐指数
1
解决办法
9182
查看次数