Questions tagged [c#]

C# is a programming language. Questions about programming are off topic. Please direct these questions to Stack Overflow.

C# is a multiparadigm, managed, garbage-collected object-oriented programming language created by Microsoft in conjunction with the .NET platform, but also used with non-Microsoft implementations (most notably, Mono).

Versions 1.0/1.2 and 2.0 of C# were submitted and approved as both ECMA and ISO/IEC standards. As of December 2010, there are no ECMA or ISO/IEC specifications for C# 3.0 and 4.0, however language specifications are available from Microsoft (3.0 and 4.0 respectively).

The language's type-system was originally static, with only explicit variable declarations allowed. However, the introduction of var (C# 3.0) and dynamic (C# 4.0) allow it to use type-inference for implicit variable typing, and to consume dynamic type-systems, respectively. Delegates (especially with lexical-closure support for anonymous-methods (C# 2.0) and lambda-expressions (C# 3.0)) allow the language to be used for functional programming.

Compilation is usually to the Common Intermediate Language (CIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR); however, options like Ngen (.NET) and AOT (Mono) mean this isn't the only option. Additionally, some frameworks (e.g. the Micro Framework) act as CIL interpreters, with no JIT.

Perhaps unusually, generics in C# are provided (in part) by the runtime, unlike (for comparison) C++ templates, or Java's generics (which use type-erasure).

With the combination of Microsoft .NET for Windows (desktop/server), Mono (desktop/server/mobile), Silverlight / Moonlight (browser/mobile), Compact Framework (mobile), and Micro Framework (embedded devices), it is available for a wide range of platforms.

Hello World

using System;
class Hello
{
    static void Main() 
    {
        Console.WriteLine("Hello, World");
    }
}

FAQs

Resources

333 questions
4
votes
3 answers

Mapping a https://... as a local logic drive?

I can map a network share point to a local logical drive by using net.exe like this: net use J: \\cnf001\test\folder1 /user: ... I build a C# lib to use Process to simulate the mapping. Now I have a case I need to map: a share point in "My…
David.Chu.ca
  • 5,165
3
votes
3 answers

Can't open an .exe app made in c# with Visual Studio

So I made a simple calculator console application with C# and Visual Studio. Now I gave the .exe file from my debug folder to a friend to test the application. Unfortunately, when he tries to open it, nothing happens. I made him check if he had .Net…
raddry
1
vote
1 answer

Windows Developer License Registration is stuck

I wanted to move on from Visual Basic to C#, so the other day I tried to create an application. It told me I need to get a developer license (at that time I was on holiday, so I couldn't be bothered). When I got home, I did the same to press I agree…
1
vote
1 answer

Removing case sensitivity

My program has a search and update function. But it will only find a match if the user types in Jane Doe not jane doe. ATM my programs retrieving user input, converting into char array and changing the first letter of each word but this doesn't seem…
Jane
  • 13
0
votes
2 answers

How to add hotkey to trigger a program?

I've deployed a project on client PC. Is it possible to add a shortcut key to invoke this program. How to make it minimized to the tray when it's triggered? (User can still open it by clicking the icon in the tray) Is it possible to do this on…
Roy.hpr
0
votes
0 answers

Google Earth plugin not working in Awesomium

We used Awesomium's demo browser to open this page: http://code.google.com/intl/fr/apis/earth/ The problem is that the Google Earth window is completely off of its position, in the top-left hand corner, as you can see…
John Johnson
0
votes
0 answers

Show Pop Up Message box window using Windows task scheduler in c#

I have created a scheduled task on my system and I want it to show an error message in a Message Box. I have tried below options but they're not working. /Create /RU SYSTEM /SC /ST /TN /TR /IT MessageBox.Show option with…
Molly
0
votes
1 answer

C# Math.POW and Manually calculating are coming out with completely different answers... Can anyone tell me why?

Forgive me if this is already on here somewhere but I couldn't find it. SO, I am doing a simple calculation. double radius = 2.50; //double pi = Math.PI; //double areaOfCircle; double radSquared = radius * radius; double radiusSquared =…
-1
votes
1 answer

Error of character use tesseract

I use tessract-ocr: var image = new Bitmap(@"C:/Users/toshiba/Desktop/lettre.jpg"); var ocr = new Tesseract(); ocr.Init(@"C:\Users\toshiba\Desktop\ravo\tessdata", "eng", false); …
-2
votes
1 answer

What is a good tool to navigate large C# code base

I am working on a large c# code base. I would like to know what is a good tool for code navigation? e.g. find out which class inherits a particular interface? where does this method get called? Should I install ctags? Or Using the search in Visual…
n179911
  • 3,673
-2
votes
1 answer

Deleting temp files via C#

Am trying to delete the temp files via C#. But it throws system.UnauthorizedAccessException. File.Delete(Path.GetTempPath()); How can i fix that issue
selva
  • 133