问题列表 - 第35091页

在这个.NET代码中遇到Generics的问题

i'm trying to make a mixed collection of Types. I know the types at the start.. but I can't seem to figure out the syntax to make the collection, etc.

eg.

....
// I leave the typo there, for embarrassment :(
Initialize(new []{ typeof(Cat), typeof(Dog), typeof(JohnSkeet) }); 
...

public Foo Initialize(IEnumerable<Type> types)
{
   // for each type, set up the inmemory storage.
   foreach(var type in types)
   {
       // ????
       // Create an empty list, which will only contain this 'type' …
Run Code Online (Sandbox Code Playgroud)

.net c# generics

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

SQLMetal Multiple Foreign Keys Pointing to One Table Issue

Edit - Cleaning up question to better reflect the actual issue:

我正在使用SQLMetal从我们的SQL Server数据库生成数据库类.最近,我需要添加一个表,其中有多个外键指向同一个表.使用LINQPad来使用新表,我能够访问两个外键的属性,如下所示:

  • record.FK_AId
  • record.FK_BId
  • record.FKA
  • record.FKB

......这就是我期待它的方式.问题是,SQLMetal生成的类产生以下属性:

  • record.FK_AId
  • record.FK_BId
  • record.FKA
  • record.FKBTableNameGoesHere

现在我可以只生成生成的类,因此FKBTableNameGoesHere将是FK_B,但生成的文件经常被不同的团队成员更改,因此这将是一个巨大的痛苦.这有一个简单的解决方案吗?

提前致谢.

编辑2 所以,我认为解决方案是创建一个具有名为我想要的属性的部分类,并让getter/setter指向命名不佳的属性.这有助于选择,但不能在where子句中使用它.任何人都有解决方案?

sqlmetal .net-4.0 linq-to-sql

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

C#Main()方法的默认访问修饰符

我在vs2010中创建了一个示例类.

通过Class View,我看到Main的默认访问修饰符是internal.

我也看到有些人说Main的默认访问修饰符是"隐式私有".

Visual Studio 2010自动将程序的Main()方法定义为隐式私有.这样做可确保其他应用程序无法直接调用另一个应用程序的入口点.

我知道内部和私人之间存在差异.哪一个是正确的?

c#

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

在ASP.NET中创建大字符串时出现OutOfMemoryException

将大量数据导出到字符串(csv格式)时,我得到一个OutOfMemoryException.解决这个问题的最佳方法是什么?该字符串将返回到Flex应用程序.

我要做的是将csv导出到服务器磁盘并返回给Flex的URL.像这样,我可以刷新写入磁盘的流.

更新:

String是使用StringBuilder构建的:

StringBuilder stringbuilder = new StringBuilder();
string delimiter = ";";
bool showUserData = true;

// Get the data from the sessionwarehouse
List<DwhSessionDto> collection 
     =_dwhSessionRepository.GetByTreeStructureId(treeStructureId);

// ADD THE HEADERS
stringbuilder.Append("UserId" + delimiter);
if (showUserData)
{
    stringbuilder.Append("FirstName" + delimiter);
    stringbuilder.Append("LastName" + delimiter);
}
stringbuilder.Append("SessionId" + delimiter);
stringbuilder.Append("TreeStructureId" + delimiter);
stringbuilder.Append("Name" + delimiter);
stringbuilder.Append("Score" + delimiter);
stringbuilder.Append("MaximumScore" + delimiter);
stringbuilder.Append("MinimumScore" + delimiter);
stringbuilder.Append("ReducedScore" + delimiter);
stringbuilder.Append("ReducedMaximumScore" + delimiter);
stringbuilder.Append("Duration" + delimiter);
stringbuilder.AppendLine("Category" + delimiter);

foreach (var dwhSessionDto in collection)
{ …
Run Code Online (Sandbox Code Playgroud)

.net asp.net response.write out-of-memory

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

如何在python egg中更新文件

我们正在使用trac.在我们的设置中,我们遇到了一个在存储库中解决的问题.所以我从存储库中获取了修复文件commit_update.py,我需要将它放入Trac-0.12-py2.6.egg.

由于鸡蛋只是一个ziped的领域我只是解开它,更改文件并再次ziped.重新启动trac后,我收到一条错误消息:

ExtractionError: Can't extract file(s) to egg cache

The following error occurred while trying to extract file(s) to the Python egg 
cache:

    [Errno 20] Not a directory

The Python egg cache directory is currently set to: 

    /var/trac/plugin-cache

Perhaps your account does not have write access to this directory?  You can 
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.
Run Code Online (Sandbox Code Playgroud)

我不太明白为什么我得到这个错误,因为我在www-data下运行trac实例,它是插件缓存的所有者.

会欣赏任何想法.

python trac egg

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

滑动到删除不起作用

滑动删除功能在我的表视图中不起作用.我已经在导航栏中实现了commitEditingStyle委托和Edit按钮.因此,当用户单击编辑按钮时,删除和添加按钮会正确显示.但是,在滑动时,删除按钮不会出现,似乎它无法识别滑动作为setEditing方法的调用.

然后我实现了willBeginEditingRowAtIndexPath和didEndEditingRwoAtIndexPath委托,如下所示:

-(void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath

{
 NSLog(@"WILL BEGIN EDITING");

 [self.tableView setEditing:YES animated:YES];

}


-(void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath

{

[self.tableView setEditing:NO animated:YES];

}
Run Code Online (Sandbox Code Playgroud)

然而,这也没有任何影响.可能的问题是什么?我已经为IB中的表格视图启用了多点触控,每个单元格都有一个DetailDisclosureButton附件.

iphone uitableview uiview ios4

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

jQuery找到第一行

如何使用jQuery查找表的第一行?

jquery jquery-selectors

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

Java:对象为byte []和byte []对象转换器(对于Tokyo Cabinet)

我需要将对象转换为byte []以存储在Tokyo Cabinet键值存储中.当从键值存储区读取时,我还需要将byte []取消对象.

那里有什么包可以帮我完成这项任务吗?或者是我自己实施的最佳解决方案?

java serialization byte bytearray tokyo-cabinet

62
推荐指数
5
解决办法
13万
查看次数

当前上下文中没有符号"颜色".GDB

我正在尝试使用gdb调试代码,但是当我尝试观察我的变量颜色时,它会说出来

No symbol "color" in current context.
Run Code Online (Sandbox Code Playgroud)

变量是一个int,显然在范围内.代码如下

int color=0;

if(color==0)
  color=1;
Run Code Online (Sandbox Code Playgroud)

我的调试器传递了变量的声明.

我只是在if(颜色== 0)处有一个断点

(gdb) watch color
Run Code Online (Sandbox Code Playgroud)

我可能怀疑编译器或其他东西,这可能吗?

编辑:在使用GDB的构造函数中调试时存在一些问题

gdb watch

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

如何增加或减少Common Lisp中的数字?

增加/减少数字和/或数字变量的惯用 Common Lisp方法是什么?

lisp common-lisp increment decrement

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