我的数据库中有一些相同数字的铃声.我希望所有这些都没有重复.然后我创建了一个比较类来完成这项工作,但是函数的执行从函数中产生了很大的延迟而没有明显的,从0.6秒到3.2秒!
我做得对吗还是我必须使用其他方法?
reg.AddRange(
(from a in this.dataContext.reglements
join b in this.dataContext.Clients on a.Id_client equals b.Id
where a.date_v <= datefin && a.date_v >= datedeb
where a.Id_client == b.Id
orderby a.date_v descending
select new Class_reglement
{
nom = b.Nom,
code = b.code,
Numf = a.Numf,
})
.AsEnumerable()
.Distinct(new Compare())
.ToList());
class Compare : IEqualityComparer<Class_reglement>
{
public bool Equals(Class_reglement x, Class_reglement y)
{
if (x.Numf == y.Numf)
{
return true;
}
else { return false; }
}
public int GetHashCode(Class_reglement codeh)
{
return …Run Code Online (Sandbox Code Playgroud) 我在企业工作,我们在解决方案项目中使用多个项目,用于UI,业务逻辑和数据访问,数据库和另一个用于打印....但现在我在新的企业,经理告诉我,我不做我必须完成所有这个项目,只需要将它们放入解决方案中的一个项目中的单独目录中.
我只是想知道我是否必须说服他使用多个项目!
我已经浏览了一个小时,还没有找到有助于此的东西.我正在使用C#从VS2013中的.NET API打开AutoCAD,但出于某种原因,我无法让AutoCAD实际启动.我正在使用以下代码:
using System;
using System.Runtime.InteropServices;
using Autodesk.AutoCAD.Interop;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
namespace IOAutoCADHandler
{
public static class ACADDocumentManagement
{
[CommandMethod("ConnectToAcad")]
public static void ConnectToAcad()
{
AcadApplication acAppComObj = null;
// no version number so it will run with any version
const string strProgId = "AutoCAD.Application";
// Get a running instance of AutoCAD
try
{
acAppComObj = (AcadApplication)Marshal.GetActiveObject(strProgId);
}
catch // An error occurs if no instance is running
{
try
{
// Create a new instance of AutoCAD
acAppComObj …Run Code Online (Sandbox Code Playgroud) 我正在使用下面的第一种方法,但后来我找到了第二种方法,想知道差异,哪种方法最好.
有什么区别:
from a in this.dataContext.reglements
join b in this.dataContext.Clients on a.Id_client equals b.Id
select...
Run Code Online (Sandbox Code Playgroud)
和
from a in this.dataContext.reglements
from b in this.dataContext.Clients
where a.Id_client == b.Id
select...
Run Code Online (Sandbox Code Playgroud) 我使用Extended WPF Toolkit BusyIndicator
我的Xaml
<extToolkit:BusyIndicator Name="wait" IsBusy="False" Cursor="Wait" Grid.ColumnSpan="3" Margin="10,10,10,10"/>
Run Code Online (Sandbox Code Playgroud)
我的代码:
private void esp_Click(object sender, RoutedEventArgs e)
{
wait.IsBusy = true;
// My work here make some time to finish
wait.IsBusy = false;
}
Run Code Online (Sandbox Code Playgroud)
但它永远不会显示,我尝试在函数的最后使MessageBox在MessageBox之后显示BusyIndicator,
我试过了
wait.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send,
(Action)delegate
{
wait.IsBusy = true;
});
Run Code Online (Sandbox Code Playgroud)
但我一无所获!这里的问题在哪里我无法解决?
我发现了一个类似的问题,但我没有出现相同的问题,指示器显示但在完成功能后.
背景:我创建了一个应用程序,它从一个比例测量一个权重,并将信息保存在MS SQL Server数据库中.
在数据库中,我想保存每天实际重量的记录作为历史记录,我不知道我必须用什么来完成这项任务.
SQL Server中的触发器可以做到吗?
很抱歉问这样的问题,但我找不到一个好的答案:/
BitmapImage和Bitmap有什么区别?
我想使用TIFF图像与我必须工作的任何一个.我发现了一些适用于BitmapImage的教程和另一个适用于Bitmap的教程.
我在我的电脑上安装了tfs 2010,我使用的是VS2010终极版,所有我的项目组都可以在没有问题的情况下(使用用户图标)进行切换,除了我; 当我签入文件时会被锁定(锁定图标)!!
我在项目中的文件:

其他个人电脑文件:

我读了这个问题,我找到了Tim Schmelter的答案:
顺便说一下,这是条件运算符和if-else之间的差异之一
你可以查看这个问题的答案,我找不到原因吗?
如果条件运算符像if-else那样工作,为什么否则不需要强制转换
题 :
int? l = lc.HasValue ? (int)lc.Value : null;
Run Code Online (Sandbox Code Playgroud)
"Tim Schmelter"回答:
你也必须施展null:
int? l = lc.HasValue ? (int)lc.Value : (int?)null;
Run Code Online (Sandbox Code Playgroud)
顺便说一句,这是条件运算符和a 之间的差异之一if-else:
if (lc.HasValue)
l = (int)lc.Value;
else
l = null; // works
Run Code Online (Sandbox Code Playgroud) 我必须在datagrid中显示一些信息,一些信息是来自数据库的大约1000条记录(sqlserver)但要显示此信息c#take除非4秒才能做到这一点....
当他没有立即看到结果时如何使用应用程序他继续按下按钮并且应用程序多次重复相同的功能(由于那个(悲伤)...
我做了一个断点,时间是在函数结束和窗口或数据网格的显示之间...是正常的!
如果是,有任何解决方案显示一个部分,当他使用滚动数据网格添加另一部分(如Facebook)?
我想知道是否有从一个特定的搜索方式指数在LINQ
这就是我想要做的例子:
//search after the 4th element if exist any true
bool result = myList.Any(a=>a.flagTodo)
// in my case I want to do like: myList.where(a=>a.index >4).Any(a=>a.flagTodo)
Run Code Online (Sandbox Code Playgroud)
有没有办法在同一个linq中做到这一点?
看到我的问题:
public class Address
{
public string Title{get;set;}
public string Description{get;set;}
}
public class Tell
{
public string Title{get;set;}
public string Number{get;set;}
}
public class Person
{
public string FirstName{get;set;}
public string LastName{get;set;}
public Address PAddress {get;set;}
public Tell PTell {get;set;}
void CreateInstanceFromProperties()
{
foreach(var prop in this.GetType().GetProperties())
{
if(prop.PropertyType.IsClass)
{
//Create Instance from this property
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我希望从我的媒体资源创建(如果它是一个类)
c# ×11
linq ×3
wpf ×3
.net ×1
autocad ×1
bitmap ×1
bitmapimage ×1
comparison ×1
datagrid ×1
join ×1
sql-server ×1
tfs2010 ×1
xaml ×1