ASP.NET Core 1.0 on IIS error 502.5 – Error Code 0x80004005

I was able to fix it by running “C:\Program Files\dotnet\dotnet.exe” “C:\fullpath\PROJECT.dll” on the command prompt, which gave me a much more meaningful error: “The specified framework ‘Microsoft.NETCore.App’, version ‘1.0.1’ was not found. – Check application dependencies and target a framework version installed at: C:\Program Files\dotnet\shared\Microsoft.NETCore.App – The following versions are installed: 1.0.0 – Alternatively, install … Read more

What is the C# version of VB.NET’s InputBox?

Add a reference to Microsoft.VisualBasic, InputBox is in the Microsoft.VisualBasic.Interaction namespace: using Microsoft.VisualBasic; string input = Interaction.InputBox(“Prompt”, “Title”, “Default”, x_coordinate, y_coordinate); Only the first argument for prompt is mandatory

Why is C# statically typed?

As others have said, C# is static/strongly-typed. But I take your question more to be “Why would you want C# to be static/strongly-typed like this? What advantages does this have over dynamic languages?” With that in mind, there are lots of good reasons: Stability Certain kinds of errors are now caught automatically by the compiler, … Read more

Self deletable application in C# in one executable

If you use Process.Start you can pass in the Del parameter and the path to the application you wish to delete. ProcessStartInfo Info=new ProcessStartInfo(); Info.Arguments=”/C choice /C Y /N /D Y /T 3 & Del “+ Application.ExecutablePath; Info.WindowStyle=ProcessWindowStyle.Hidden; Info.CreateNoWindow=true; Info.FileName=”cmd.exe”; Process.Start(Info); Code snippet taken from this article

ReadKey InvalidOperationException application does not have a console

Found my answer in OmniSharp Visual Code docs: https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window Console (terminal) window By default, processes are launched with their console output (stdout/stderr) going to the VS Code Debugger Console. This is useful for executables that take their input from the network, files, etc. But this does NOT work for applications that want to read from … Read more

How does deferred LINQ query execution actually work?

Your query can be written like this in method syntax: var query = numbers.Where(value => value >= threshold); Or: Func<int, bool> predicate = delegate(value) { return value >= threshold; } IEnumerable<int> query = numbers.Where(predicate); These pieces of code (including your own query in query syntax) are all equivalent. When you unroll the query like that, … Read more

How to delete an array in c#?

Say you call: void Foo(){ int[] a = new int[5]; } In C# there is no way to undefine the variable a. That means a will be defined in Foo even if you set a to null. However, at the end of Foo a will fall out of scope. That means no code can reference … Read more

How to rename XML attribute that generated after serializing List of objects

The most reliable way is to declare an outermost DTO class: [XmlRoot(“myOuterElement”)] public class MyOuterMessage { [XmlElement(“item”)] public List<TestObject> Items {get;set;} } and serialize that (i.e. put your list into another object). You can avoid a wrapper class, but I wouldn’t: class Program { static void Main() { XmlSerializer ser = new XmlSerializer(typeof(List<Foo>), new XmlRootAttribute(“Flibble”)); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)