我已经下载了Visual Studio Community 2015(免费版),我没看到截止日期是什么时候.
我试图在帮助菜单 - >关于Microsoft Visual Studio中查看到期日期,并且没有到期日期.
是否有任何到期日期(我有一个Microsoft帐户)?如果是,我在哪里可以看到它?或者直到什么时候?
我发现很多次我不需要TryParse方法的out参数,但问题是必然的.在这里,我将展示一个不需要的例子.
我想检查字符串是否为整数,如果是整数则打印"整数"; 否则,打印"不是整数".所以这是代码:
string value = Console.ReadLine(); //Get a value from the user.
int num; //Why should I have it?? No need at all !
if (int.TryParse(value, out num))
{
Console.WriteLine("An integer");
}
else
{
Console.WriteLine("Not an integer");
}
Run Code Online (Sandbox Code Playgroud)
我只是想知道为什么TryParse总是返回一个out参数?为什么没有out参数就没有过载?
我在我的项目中使用了Windows应用商店8.0并将其升级为8.1.并且还将Visual Studio从2012年升级到2013年.
首先,我收到一个错误,无法使用Microsoft.VCLibs版本11.0和12.0.所以我删除了11.0版本.
然后我得到了这个错误:
我试图在互联网上找到一些信息,但没有.此外,当我双击错误时,它不会带我到错误的位置.
我试图做很多事情,没有任何帮助,所以我决定写这篇文章.
有人可以帮我解决这个错误吗?
编辑:
我正在添加更多信息,这可能会导致问题:
解决了:
在Hans Passant的帮助下,错误已得到修复.问题是我的资源文件中有这个副本:
我做了两次,因为一个是按钮(有内容),一个是代码背后的消息对话框.
在Visual Studio 2012中,此代码工作正常,但不知何故,不在Visual Studio 2013中.
我删除了Cancel.Content行,错误消失了,它工作正常:)
我正在开发一个新项目,我注意到一些代码,我不确定是否属实.我用来证明问题的名称和值是假的.
public class MyConsts //Should it be static?
{
public const string MyConst1 = "a";
public const string MyConst2 = "b";
public const string MyConst3 = "c";
public const string MyConst4 = "d";
....
}
Run Code Online (Sandbox Code Playgroud)
对于我的逻辑,这个类(只包含consts值)应该是静态的,所以没有选项来初始化它,这没有任何意义,我是否正确?
编辑:我正在写代码盲,所以我混淆了字符串和常量的顺序 - 因为它不是我的问题的目标,我已经修复了这个.
我只是想知道下两个语句之间有什么区别:
导致NullReferenceException - 没关系.
object test1 = default(int?);
object result = test1.ToString();
Run Code Online (Sandbox Code Playgroud)返回一个空字符串"",为什么?
object test2 = default(int?).ToString();
Run Code Online (Sandbox Code Playgroud)这与2相同.
int? test3 = null;
if (test3.ToString() == string.Empty) //returns true
{
Console.WriteLine("int? = String.Empty, isn't it strange?").
}
Run Code Online (Sandbox Code Playgroud)而且只是为了好玩 - 我可以证明bool可以等于int值(嗯,怎么样?bool只能是false,或者是true,而int永远不会那样).
if (default(int?).ToString() == default(bool?).ToString()) //returns true because both are empty strings
{
Console.WriteLine("int = bool");
}
Run Code Online (Sandbox Code Playgroud)注意: default(int?)返回null.
我正在尝试使用Dapper.Contrib更新此表:
public class MyTable
{
public int ID { get; set; }
public int SomeColumn1 { get; set; }
public int SomeColumn2 { get; set; }
public int CreateUserID { get; set; }
public int UpdateUserID { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我不想更新CreateUserID列,因为它是一个更新方法,所以我想在调用Dapper - Update.Async(entity)方法时忽略此列.
我尝试使用[NotMapped]和[UpdateIgnore]属性,但没有帮助.
注意:我仍然希望在插入操作上传递此列,因此,[Computed]和[Write(false)]不合适.
有人可以帮我弄清楚在更新数据库中的表时如何忽略此列?
提前致谢.
我的服务器上的ASP.NET应用程序在运行几天后开始抛出GDI +异常.重新启动服务器后,所有工作正常几天,然后突然再次发生此异常.在第一次发生之后,每当我尝试保存PNG图像时都会发生,直到我再次重新启动.
当我尝试以JPEG格式保存图像时,它工作正常.
当我从我的项目运行此代码时,它失败:
var path = @"C:\Project\images\logo.png";
var image = Image.FromFile(path);
using (var ms = new MemoryStream())
{
image.Save(ms, ImageFormat.Png); // Fails here on GDI+ exception.
//image.Save(ms, ImageFormat.Jpeg); // JPEG works somehow
}
Run Code Online (Sandbox Code Playgroud)
再说一次:当我重新启动远程桌面并运行此代码时,它会工作几天,并在某个时刻突然开始一次又一次地失败.
我试过了:
使用相同的代码创建控制台应用程序并在项目所在的RDP中运行它.它工作正常!
我在这个主题上阅读的10多篇文章中提出了很多不同的代码变体.
GCI.Collect() - 没有帮助.
检查了所有具有写权限的文件夹(也许IIS有什么东西?).
更多.
我认为它应该是一些突然因某些东西而改变的配置,我无法理解它是什么.
我只是想构建一个动态过滤器.最后回归
Expression<Func<Event, bool>>
Run Code Online (Sandbox Code Playgroud)
我曾尝试使用Combine(AndAlso)表达式,但它不起作用,最后我发现有IQueryable查询效果很好,但现在我怎样才能将它转换为返回类型 -
Expression<Func<Event, bool>>?
Run Code Online (Sandbox Code Playgroud)
我的代码:
public IQueryable<Event> GetBySearch(EventFilter search)
{
IQueryable<Event> query = this.Context.Events.AsQueryable();
Expression<Func<Event, bool>> expression = null;
if (search.CategoryId != 0)
{
query = query.Where(x => x.CategoryId == search.CategoryId);
}
if (search.SubCategoryId != 0)
{
query = query.Where(x => x.SubCategoryId == search.SubCategoryId);
}
expression = query.Expression as Expression<Func<Event, bool>>; //This convert is not working, it returns null.
return this.Context.Events.Where(expression);
}
Run Code Online (Sandbox Code Playgroud) 我已经从Windows 8.0将我的项目升级到Windows 8.1,并获得了一些过时代码的警告.其中一些我已修复,其中一些没有.
这是我无法修复的最后警告的图像,无法找到任何信息.
所有警告都指的是相同的方法,它说它已经过时了,我该怎么办才能获得不过时的代码?
以下是代码:
警告号码2.
/// <summary>
/// Translates <see cref="ApplicationViewState" /> values into strings for visual state
/// management within the page. The default implementation uses the names of enum values.
/// Subclasses may override this method to control the mapping scheme used.
/// </summary>
/// <param name="viewState">View state for which a visual state is desired.</param>
/// <returns>Visual state name used to drive the
/// <see cref="VisualStateManager" /></returns>
/// <seealso cref="InvalidateVisualState" />
protected virtual string DetermineVisualState(ApplicationViewState viewState) …
Run Code Online (Sandbox Code Playgroud)我在AWS EC2中使用Web和数据库实例,我想让它们具有高可用性,这样如果一台服务器出现故障(主服务器),则打开另一台服务器(辅助服务器).
我已经找到了很多关于RDS高可用性的信息,但没有找到非RDS的EC2实例.
谢谢.