如何从命令行启动Notepad ++,提供两个文件并使用diff/compare打开它?
我有三个类:ClassA,ClassB,ClassC.
ClassC延伸ClassB,反过来延伸ClassA.
当我从ClassA构造函数中调用GetType()时,.net返回ClassC的类型.我感到困惑,因为这种情况发生在已经工作了一段时间的代码中,而且我有一段时间没有碰过.是否有.net的修补程序改变了GetType()的行为?我不信.我唯一的另一个想法是,这与xUnit有关,我正在使用的测试框架?
我在Windows上使用最新版本的R/xts/zoo:R 2.15,xts 0.8-6,zoo 1.7-7
我看到了以下奇怪的行为,与以前的版本不同:
library(xts)
data(sample_matrix)
sample.xts <- as.xts(sample_matrix)
sample.xts[1, 2] - sample.xts[2,2] # results in numeric(0)?!?!?!
(sample.xts[ 1, 2] - sample.xts[2,2])/sample.xts[3,1] # if I run this twice R locks up
Run Code Online (Sandbox Code Playgroud)
在这里,我有一个XTS对象的子集到一个单元格.减法不再有效.此外,除法导致R完全锁定.
有没有人看到这个?这是一个已知的错误还是我错过了什么?我可以在两台机器上重现这个.
会话信息(删除一些保密包):
R version 2.15.0 (2012-03-30)
Platform: x86_64-pc-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] parallel stats graphics utils datasets grDevices methods base
Run Code Online (Sandbox Code Playgroud) 在下面的示例中,我试图理解为什么BaseType不是泛型类型定义,更一般地说,为什么它不只是等于typeof(List<>)
public class MyList<T> : List<T>
{
}
// this is true by definition
typeof(List<>).IsGenericTypeDefinition
// this is false
// also the BaseType.FullName is null ?!?
// also BaseType.IsConstructedGenericType is true ?!?!?
// as such, BaseType != typeof(List<>)
typeof(MyList<>).BaseType.IsGenericTypeDefinition;
Run Code Online (Sandbox Code Playgroud)
编辑-以下是相关主题的一些有用链接:
Type.IsGenericTypeDefinition 和 Type.ContainsGenericParameters 之间的区别
https://learn.microsoft.com/en-us/dotnet/api/system.type.isgenerictype
是否可以使用反射来区分 getter-only 属性和表达式主体属性?
class MyClass
{
DateTime GetterOnly { get; }
DateTime ExpressionBody => DateTime.Now;
}
Run Code Online (Sandbox Code Playgroud)
例如,下面的方法如何完成?
enum PropertyKind
{
NotInteresting,
GetterOnly,
ExpressionBody,
}
PropertyKind GetPropertyKind(PropertyInfo propertyInfo)
{
if (propertyInfo.GetSetMethod(true) == null)
{
// what goes here??
}
return PropertyKind.NotInteresting;
}
Run Code Online (Sandbox Code Playgroud)
伙计们,
如果我在一个长时间运行的方法中设置一个大对象.net为null(不一定是CPU密集型...只是长时间运行)它是垃圾收集的立即游戏还是该方法需要在对象之前完成准备垃圾收集?
是否可以从Microsoft.Office.Interop.Excel.ApplicationClass确定Excel是以32位还是64位运行?
编辑
该解决方案应适用于Excel 2010和Excel 2007
我还是R的新手,通过模式完成我的所有子集:
data [生成与数据长度相同的逻辑的命令]
或
子集(data,生成与数据长度相同的逻辑的命令)
例如:
test = c("A", "B","C")
ignore = c("B")
result = test[ !( test %in% ignore ) ]
result = subset( test , !( test %in% ignore ) )
Run Code Online (Sandbox Code Playgroud)
但我依稀记得从我的读物中可以看到更短/(更可读?)的方法吗?也许使用"with"功能?
有人可以列出上述示例的替代方案,以帮助我理解子集化中的选项吗?
如何测试两个函数变量指向同一个函数?
test = lm
test2 = lm
test == lm # error: comparison (1) is possible only for atomic and list types
test == test2 # error: comparison (1) is possible only for atomic and list types
Run Code Online (Sandbox Code Playgroud) .net ×5
r ×4
.net-4.0 ×3
c# ×3
.net-4.6 ×1
32bit-64bit ×1
c#-7.0 ×1
excel ×1
ggplot2 ×1
notepad++ ×1
reflection ×1
type-systems ×1
types ×1
xts ×1
zoo ×1