小编Kus*_*sek的帖子

MSBuild vs nant

我们使用nant来构建我们的项目(10 + Class Lib)和一个基于ASP.NET 2.0的Web站点.最近我们正在向ASP.NET 3.5迈进.我在网上搜索,发现nant不支持3.5.

我也在寻找迁移MSBuild的选项.

  1. MS Build是否适合这个?
  2. 我听说有人说MSBuild很慢?这是真的吗?
  3. 使用MS Build,我可以进行单步构建吗?我所要做的就是调用nant.ext并给出一个构建文件,它将进行构建并给出输出.

msbuild nant

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

字符串数组中的LINQ"zip"

假设有两个数组:

String[] title = { "One","Two","three","Four"};
String[] user = { "rob","","john",""};
Run Code Online (Sandbox Code Playgroud)

我需要在user值为Empty 时过滤掉上面的数组,然后将两者连接或压缩.最终输出应该是:

{ "One:rob", "three:john" } 
Run Code Online (Sandbox Code Playgroud)

如何使用LINQ完成?

c# linq

11
推荐指数
3
解决办法
9085
查看次数

扩展方法性能

            /*I have defined Extension Methods for the TypeX like this*/ 
        public static Int32 GetValueAsInt(this TypeX oValue)
        {
            return Int32.Parse(oValue.ToString());
        }
        public static Boolean GetValueAsBoolean(this TypeX oValue)
        {
            return Boolean.Parse(oValue.ToString());
        }


         TypeX x = new TypeX("1");
         TypeX y = new TypeX("true");


         //Method #1
         Int32 iXValue = x.GetValueAsInt();
         Boolean iYValue = y.GetValueAsBoolean();

         //Method #2
         Int32 iXValueDirect = Int32.Parse(x.ToString());
         Boolean iYValueDirect = Boolean.Parse(y.ToString());
Run Code Online (Sandbox Code Playgroud)

不要被TypeX带走,说我应该在TypeX中定义那些方法而不是扩展)我无法控制它(实际类我定义它在SPListItem上.

我想将TypeX转换为Int或Boolean,这个操作是我在代码中的很多Places中做的一件常见的事情.我想知道这会导致性能下降.我试图使用Reflector解释IL代码,但我并不擅长.可能对于上面的例子,不会有任何性能降低.总的来说,我想知道在使用Extension方法时对Regard对Performance的影响.

.net-3.5 c#-3.0

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

外键上的实体框架nvarchar案例敏感性

我有相当简单的表格结构如下,发出的声音对我来说很奇怪.虽然我选择了解决它,但想听听专家的意见.

我有两张桌子

Users
UserName nvarchar(250) Primary Key
FirstName nvarchar(50)
LastName  nvarchar(50)

Registrations
Id BigInt PrimaryKey
User nvarchar(250) - Foreign to Users Table
Date - DateTime

Data I have is as follows.
Users
UserName FirstName LastName
a        Small     A 
b        Small     B

Registrations
Id       User      Date
1        A         1/1/12
2        B         1/1/12
Run Code Online (Sandbox Code Playgroud)

请注意这里的用户案例是它在SQL中有效,它接受.

现在是有趣的部分.我生成了EDMX,.Net 4.0,现在我执行了这段代码.

 using (EFTestEntities context = new EFTestEntities())
            {
                var item = context.Registrations.Where(id => id.Id == 1).FirstOrDefault();
                Response.Write(item.User1.LastName);
            }
Run Code Online (Sandbox Code Playgroud)

它只是打破空指针异常User1抛出Null,当我将Registrations表中的UserName列的值更改为a而不是A时它可以工作.

这个链接谈论有点相似

这 …

.net linq-to-sql entity-framework-4 c#-4.0

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

AmbiguousMatchException - Type.GetProperty - C#Reflection

昨天我在开发Web部件时遇到了一个问题(这个问题不是关于webpart而是关于C#).关于问题的小背景.我有一个使用Reflection加载WebPart的代码,其中我得到了AmbiguousMatchException.要重现它,请尝试以下代码

        public class TypeA
        {
            public virtual int Height { get; set; }
        }
        public class TypeB : TypeA
        {
            public String Height { get; set; }
        }
        public class Class1 : TypeB
        {

        }

        Assembly oAssemblyCurrent = Assembly.GetExecutingAssembly();
        Type oType2 = oAssemblyCurrent.GetType("AmbigousMatchReflection.Class1");
        PropertyInfo oPropertyInfo2 = oType2.GetProperty("Height");//Throws AmbiguousMatchException 
        oPropertyInfo2 = oType2.GetProperty("Height", 
            BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance);  // I tried this code Neither these BindingFlags or any other didnt help
Run Code Online (Sandbox Code Playgroud)

我想知道BindingFlag来获取高度属性.您将有一个问题,我为什么要创建另一个已经存在于Base类中的Height属性.这就是Microsoft.SharePoint.WebPartPages.PageViewerWebPart设计的方法,检查PageViewerWebPart类的Height属性.

c#

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

SharePoint 2010 for SharePoint 2007开发人员入门

您是否知道一些有助于SharePoint 2007开发人员开始使用SharePoint 2010的快速链接.

让我从我知道的链接开始.

  1. 有关SharePoint 2010的常规信息
  2. 必须观看SharePoint 2010的视频

sharepoint sharepoint-2010

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

HttpContext.Current.User.Identity.Name返回错误的用户名

它是使用SQL Membership Provider进行身份验证的Plain ASP.NET应用程序.虽然应用程序在大多数时间运行良好.我们最近看到用户抱怨他们正在看到其他用户帐号.

我很确定并再次确认我直接在代码中使用HttpContext.Current.User.Identity.Name来获取用户信息.因此,在重负载下,我会返回不同的用户名.

有没有人遇到类似的问题?有可能吗?

应用程序运行在ASP.NET 4.0,Web窗体,无缓存,代码中没有处理任何cookie,没有嗅探cookie的Javascripts.

我看到这两个链接大致相同但没有回答.

http://bytes.com/topic/asp-net/answers/324385-serious-issue-httpcontext-current-user-identity-name

http://www.experts-exchange.com/Web_Development/Miscellaneous/Q_21105924.html

asp.net httpcontext

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

Google Colab ModuleNotFoundError:没有名为“sklearn.externals.joblib”的模块

我的初始导入如下所示,并且该代码块运行良好。

# Libraries to help with reading and manipulating data
import numpy as np
import pandas as pd

# Libraries to help with data visualization
import matplotlib.pyplot as plt
import seaborn as sns

sns.set()

# Removes the limit for the number of displayed columns
pd.set_option("display.max_columns", None)
# Sets the limit for the number of displayed rows
pd.set_option("display.max_rows", 200)

# to split the data into train and test
from sklearn.model_selection import train_test_split

# to build linear regression_model
from sklearn.linear_model import LinearRegression …
Run Code Online (Sandbox Code Playgroud)

python google-colaboratory sequentialfeatureselector

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

将.NET WebService暴露给其他平台(Java)

我想在.NET中开发一个Web服务,并希望这个Web服务可以在Java中使用.我需要遵循哪些步骤.我写了几个Web服务但是客户端都是.Net.请让我知道我应该遵循的步骤.

另外我的网络服务将把二进制文件作为输入,请让我知道如何实现这一目标?

.net asp.net

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

SharePoint可用性

我想创建一个允许应用程序高度可用的SharePoint Server安装程序.假如我们在SharePoint中有一个门户网站,并且我想让它始终可用.我知道这与WFE有关.有人指导我需要为此设置的文章或Arch.

sharepoint

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