我有三个简单的课程:
class A
{
public virtual void Write()
{
Console.Write("A");
}
}
class B:A
{
public override void Write()
{
Console.Write("B");
}
}
class C : B
{
public new void Write()
{
Console.Write("C");
}
}
Run Code Online (Sandbox Code Playgroud)
我正在创建对象并调用他们的方法:
A a = new A();
a.Write();
A b = new C();
b.Write();
C c = new C();
c.Write();
Run Code Online (Sandbox Code Playgroud)
输出将是: ABC
我无法理解的是这些代码产生的原因B?:
A b = new C();
b.Write();
Run Code Online (Sandbox Code Playgroud)
我认为它应该是C.但是,我测试了很多次,而且它总是如此B.
我理解A b = new C()创建C的新对象类型.所以输出应该是C.或者在我们使用它而不进行转换时调用重写方法是特殊行为? …
我想X509Certificate2从字符串创建.让我举个例子:
string keyBase64String = Convert.ToBase64String(file.PKCS7);
var cert = new X509Certificate2(Convert.FromBase64String(keyBase64String));
Run Code Online (Sandbox Code Playgroud)
并keyBase64String有这样的内容:"MIIF0QYJKoZI ........hvcNAQcCoIIFwjCCBb4CA0="
并且file.PKCS7是我从数据库下载的字节数组.
创建时我遇到以下异常X509Certificate2:
找不到请求的对象
并且堆栈跟踪:
"无法在系统中的System.Security.Cryptography.X509Certificates.X509Utils._QueryCertBlobType(Byte [] rawData)处的System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32hr)中找不到请求的对象"X509Certificate2异常"无法找到请求的对象"}. WebApp.SoupController.d__7.MoveNext()上的System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte [] rawData)中的Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte [] rawData,Object password,X509KeyStorageFlags keyStorageFlags)在D:\ Projects\WebApp\Controllers\SoupController.cs中:第118行
请告诉我我做错了什么.任何帮助将不胜感激!
我有一个 WPF 窗口,其中一些属性被定义为动态资源,如下所示:
<Window x:Class="LocSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
MinHeight="350" MinWidth="525"
Title="{DynamicResource ResourceKey=ResId_Title}"
FlowDirection="{DynamicResource ResId_FlowDirection_Default}" >
<Grid>
<Label Content="{DynamicResource ResId_FirstName}" />
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
将ResourceDictionary在运行时加载,以反映语言选择的用户。并使用户能够即时切换语言。
这在运行时工作正常,但在设计时,不显示资源定义的属性。我很清楚设计师不能展示它们,因为它们在设计时没有定义。
我需要一种ResourceDictionary在设计时加载默认值的方法,以便设计人员可以显示任何内容。
是否可以在没有Nuget的情况下下载VS 2012的文件并将必要的文件安装到VS 2012?
我没有在我的电脑上访问互联网,所以我找到了其他方法来下载必要的项目并在没有Nuget :)的VS 2012中安装这些文件.不过,我想在VS 2012中拥有模板,就像我有模板一样,好像我会通过Nuget下载这些项目.
我试过这样的名字Button:
<Button Content="<-Delete" />
Run Code Online (Sandbox Code Playgroud)
但我看到了错误:
令牌" - 删除"是意外的
如何包含<签到的Content财产Button?
我使用以下命令在ambari-server中提交了我的spark作业..
./spark-submit --class customer.core.classname --master yarn --numexecutors 2 --driver-memory 2g --executor-memory 2g --executor-cores 1 /home/hdfs/Test/classname-0.0.1-SNAPSHOT-SNAPSHOT.jar newdata host:6667
Run Code Online (Sandbox Code Playgroud)
它工作得很好......
但是,如果我们关闭命令提示符或尝试终止作业,它将如何继续运行,它必须继续运行.
任何帮助表示赞赏.
我有一个Android按钮,我想给它一个背景颜色和两个涟漪效果
我的涟漪xml如下.
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:color="#BDA0CB"
tools:targetApi="lollipop">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="#BDA0CB" />
</shape>
</item>
</ripple>
Run Code Online (Sandbox Code Playgroud)
我的按钮是
<Button android:id="@+id/Button_activity_login_ViewProfile" style="?android:textAppearanceSmall"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:text="Save"
android:textStyle="bold"
android:layout_marginLeft="@dimen/margin_left"
android:layout_marginRight="@dimen/margin_right"
android:textColor="#ffffffff"
android:fontFamily="sans-serif"
android:background="#ff7e51c2" />
Run Code Online (Sandbox Code Playgroud)
要给出涟漪效果,我必须删除背景颜色......有没有办法可以保留两者.
我尝试通过Angular 2 Observable subscribe方法的例子来理解typescript的箭头函数.有人可以解释我:
我有这个代码有效:
this.readdataservice.getPost().subscribe(
posts => { this.posts = posts; }
);
Run Code Online (Sandbox Code Playgroud)
但如果我使用它,它应该是一样的吗?但这不起作用.
this.readdataservice.getPost().subscribe(
function (posts) {
this.posts = posts;
}
);
Run Code Online (Sandbox Code Playgroud) 我看过这篇文章,但不是我的情况,因为我从Visual Studio运行我的项目.它不是已部署的应用程序.
我最近安装了Visual Studio 2015 Professional Update 3,并且我使用AngularJS 2应用程序在本地 运行ASP.NET Core Web.我运行应用程序时看到的错误是:
HTTP错误502.5 - 进程失败
这个问题的常见原因:
应用程序进程无法启动应用程序进程
启动但后停止应用程序进程已启动但未通过
监听配置的端口
我已经在我的电脑上安装了以下软件包:
有谁知道如何解决这个错误?
我有一个使用数组和谓词来执行数组过滤的实用程序,但是在将我的自定义类型用于谓词后,我收到一条错误消息
类型“T”上不存在属性“名称”
我认为通用属性类型T会接受任何东西?
我错过了一些明显的东西吗?
数组.ts
export type arrayPredicate = <T>(arg: T) => boolean;
Run Code Online (Sandbox Code Playgroud)
数组实用程序
static filterArray<T>(array: T[], arrayPred: arrayPredicate): T {
const key = Object.keys(array).find(obj => arrayPred(array[obj]));
return array[key];
}
Run Code Online (Sandbox Code Playgroud)
测试中的使用
const array = [
{
'name': 'object-1',
'id': 1
},
{
'name': 'object-2',
'id': 2
}
];
it(... , () => {
// I get red squigglies under '.name'
const myObj = ArrayUtils.filterArray(exceptionalStatuses,
(status => status.name === findStatus));
...
});
Run Code Online (Sandbox Code Playgroud)
当然,改变
c# ×4
angular ×2
javascript ×2
typescript ×2
wpf ×2
.net ×1
android ×1
apache-spark ×1
asp.net ×1
asp.net-core ×1
background ×1
encryption ×1
inheritance ×1
nuget ×1
ripple ×1
shell ×1
types ×1
xaml ×1