我正在使用SourceTree并尝试从一般的github存储库克隆,但我收到此错误:
致命:无法访问" https://github.com/mfitzp/15-minute-apps.git/ ":错误:1407742E:SSL例程:SSL23_GET_SERVER_HELLO:tlsv1警报协议版本已完成但有错误,请参阅上文.
怎么解决?
我是整个MVC的新手,我正在考虑使用ASP.NET Web API重新实现一些WCF服务.作为其中的一部分,我想实现一个动作过滤器,记录所有动作和异常以及定时,所以我认为我会从动作过滤器开始,但是没有调用过滤器.
public class MyTrackingActionFilter : ActionFilterAttribute, IExceptionFilter
{
private Stopwatch stopwatch = new Stopwatch();
public void OnException(ExceptionContext filterContext)
{
...
}
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
...
}
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
this.stopwatch.Start();
Trace.TraceInformation(" Entering {0}", filterContext.RouteData);
}
}
Run Code Online (Sandbox Code Playgroud)
在控制器上,我有
[MyTrackingActionFilter]
public class MyResourceController : ApiController
{
...
}
Run Code Online (Sandbox Code Playgroud)
使用以下调用在Global.asax中设置路由:
var routeTemplate = ...
var defaults = new { controller = controllerName, action = methodName };
var constraints = new { httpMethod = new HttpMethodConstraint(myHTTPMethods.Split(',')) …Run Code Online (Sandbox Code Playgroud) 我从同事那里得到了这个项目,在构建项目时遇到了这个错误:
无法加载文件或程序集“System.Runtime,Version=4.2.1.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。该系统找不到指定的文件。
我猜这个dll位于.NET Framework Dll文件夹:中C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework,但是经过搜索,我发现了很多其他版本的dll,但我没有找到任何System.Runtime.dll是4.2.1.0。
这是另一个类似的问题,但没有答案。
System.Runtime.dll 4.2.1.0.NET Framework 中真的存在吗?
大多数地方JSON的格式都是这样的
{
color: "red",
value: "#f00"
}
Run Code Online (Sandbox Code Playgroud)
要么
[
{ color: "red", value: "#f00" },
{ color: "red", value: "#f00" }
]
Run Code Online (Sandbox Code Playgroud)
我想问的是原始类型如string,bool,int也是JSON?
我找到了以下链接,
http://json-schema.org/latest/json-schema-core.html
https://zh.wikipedia.org/wiki/JSON
https://www.ietf.org/rfc/rfc4627.txt
http://www.c-sharpcorner.com/uploadfile/3d39b4/data-types-in-json/
和,
在RFC4627中它说
JSON可以表示四种基本类型(字符串,数字,布尔值和null)和两种结构化类型(对象和数组).
字符串是零个或多个Unicode字符序列[UNICODE].
对象是零个或多个名称/值对的无序集合,其中名称是字符串,值是字符串,数字,布尔值,空值,对象或数组.
数组是零个或多个值的有序序列.
术语"对象"和"数组"来自JavaScript的约定.
所以我把它读作纯字符串,数字布尔像
"a string"
100
true
Run Code Online (Sandbox Code Playgroud)
都是JSON,
但我的两位同事认为原始类型只能是对象的价值,
{ ASTRING : "astring" } 是JSON,
如果只有"a string",这不会被调用,因为它不是JSON格式,
我想我,我的同事可能不够专业,无法判断,
所以我想知道,纯粹的原始类型JSON?
.
另一个想法是,JSON被称为交换数据的便捷方式,但如果这种格式不支持纯字符串,
也就是说,如果我只是想抛弃一个字符串,我不能使用JSON来做它?
并且必须强迫它改变{ Message : "a message"},
并且不能使用我认为更简单的方式抛出"a message"...?
我在C#中找到了两个与AES相关的类,它们与MSDN提供的示例代码类似,这两个类有什么区别?
Aes班
https://msdn.microsoft.com/en-us/library/system.security.cryptography.aes(v=vs.110).aspx
AesManaged类
https://msdn.microsoft.com/en-us/library/system.security.cryptography.aesmanaged(v=vs.110).aspx
如何在WPF中的RichTextBox中设置插入符/光标位置?
我使用MSDN CaretPosition中的代码,但似乎无法设置光标?
// Create a new FlowDocument, and add 3 paragraphs.
FlowDocument flowDoc = new FlowDocument();
flowDoc.Blocks.Add(new Paragraph(new Run("Paragraph 1")));
flowDoc.Blocks.Add(new Paragraph(new Run("Paragraph 2")));
flowDoc.Blocks.Add(new Paragraph(new Run("Paragraph 3")));
// Set the FlowDocument to be the content for a new RichTextBox.
RichTextBox rtb = new RichTextBox(flowDoc);
// Get the current caret position.
TextPointer caretPos = rtb.CaretPosition;
// Set the TextPointer to the end of the current document.
caretPos = caretPos.DocumentEnd;
// Specify the new caret position at the …Run Code Online (Sandbox Code Playgroud) 我尝试以下代码使用==和Equals数字比较:
Console.WriteLine( (int)2 == (double)2.0 );
Console.WriteLine( ( (int)2 ).Equals( (double)2.0) );
Console.WriteLine((float)2.0 == (double)2.0);
Console.WriteLine( ( (float)2.0 ).Equals( (double)2.0 ) );
Run Code Online (Sandbox Code Playgroud)
结果:
true
false
true
false
Run Code Online (Sandbox Code Playgroud)
int, double, float都是ValueType,在阅读了帖子Here1和Here2后,我仍然无法理解为什么==结果Equals不同,
这4个案例==背后的工作细节是什么?Equals
(如果这个问题重复,请告诉我)
编辑: 4个更有趣的案例:
双精度型、浮点型 <-> 整数型
Console.WriteLine((double)2.0 == (int)2); //True
Console.WriteLine(((double)2.0).Equals((int)2)); //True
Console.WriteLine((float)2.0 == (int)2.0); //True
Console.WriteLine(((float)2.0).Equals((int)2.0)); //True
Run Code Online (Sandbox Code Playgroud)
双精度型、整型 <-> 浮点型
Console.WriteLine((double)2.0 == (float)2.0); //True
Console.WriteLine(((double)2.0).Equals((float)2.0)); //True
Console.WriteLine((int)2 == (float)2.0); //True …Run Code Online (Sandbox Code Playgroud) 我和HERE有同样的问题,但我正在使用C#,
如何在C#中做到这一点?
(如果使用Tostring("F")作为此处,所有浮点数将变为X.XX,也为0到0.00)
这是一个浮点数的例子
232.00000000
0.18000000000
1237875192.0
4.5800000000
0.00000000
1.23450000
Run Code Online (Sandbox Code Playgroud)
我想把它们变成:
232
0.18
1237875192
4.58
0
1.2345
Run Code Online (Sandbox Code Playgroud)
编辑
(我突然发现我想做的事情比上面的更复杂但是修改问题已经太晚了,也许我会在另一个问题上问它......)
当我使用VisualStudio 2013构造Asp.Net WebAPI时,添加
Web API 2 OData控制器,具有使用实体框架的操作
添加成功后,我运行API,然后发生错误?
无法加载文件或程序集“ Microsoft.Data.OData,版本= 5.6.0.0,区域性=中性,PublicKeyToken = 31bf3856ad364e35”或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。(来自HRESULT的异常:0x80131040)
怎么解决呢?