In my MVC application, a superadministrator can set a queue of tasks such as updating database. So, when an admin adds an update to the queue, the controller starts a new tasks that works in a background. However, when you add a few tasks, the applic
I have a non-static property inside a non-static MainForm class: public string SelectedProfile { get { return (string)cbxProfiles.SelectedItem; } set { cbxProfiles.SelectedItem = value; } } I would like to get the value of this property, from another
I have a console application and I want to open a asp.net page from it. I tried this: HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:9000/"); client.GetAsync("http://localhost:9000/"); but when I r
Check out this program: static class Program { static void Main() { GetLinks(); Console.WriteLine("Program failed!"); } static IEnumerable<string> GetLinks() { throw new Exception(); foreach (var item in new string[] { }) yield return item
If I have a CryptoStream that I want to pass back to the user, the naïve approach would be public Stream GetDecryptedFileStream(string inputFile, byte[] key, byte[] iv) { var fsCrypt = new FileStream(inputFile, FileMode.Open, FileAccess.Read, FileSha
I'm here with a problem of a simple RegExp. I want to retrieve from a specific string all substrings that accomplish with the following rules: 1. The values are between TABs. 2. Also include double quotes. How can I do that? I found the way to get th
Binding Drop down with localized value using enum in C#. I have value for all the languages. So I do not need to fetch it from anywhere else. I can write all the value in different languages resx file. But I am not sure how it works. I am using C# wi
The following code does not compile: [<Struct>] type Point(x:int, y:int) = member __.X = x member __.Y = y member __.Edges = ArrayList<Edge>() [<Struct>] and Edge(target:Point, cost:int) = member __.Target = target member __.Cost = cost
My json string including a fixed type header and non-fixed type body as bellow: [DataContract] public class ServiceResponseHeader { [DataMember] public string ErrorCode { get; set; } [DataMember] public string Message { get; set; } } [DataContract] p
I'm trying to updata my sql database for a specific name, and the following code is not working. Any ideas why? Here is what I am doing on the button click: string person = listBox2.SelectedItem.ToString(); string memberStatus = "platinum"; stri
I was wondering if exist a trick to use a Type as an expression, for example in this code: Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim ControlType = CheckBox ' CheckBox is a type and cannot be used as an expressio
Until today I (implicitly) assumed that when I output a BigInteger via the parameterless (overridden) instance method BigInteger.ToString() then the return string would contain the complete and exact decimal representation of my "big" integer. B
I'm trying to go through a web pages source code, add the <img src="http://www.dot.com/image.jpg" to an HtmlElementCollection. Then I'm attempting to cycle through each element in the element collection with a foreach loop and download the im
Possible Duplicate: The type of the conditional expression can not be determined? I currently wrote this statement: byte? Col_8 = (Rad_8.SelectedValue == null) ? null : byte.Parse(Rad_8.SelectedValue); but it has this Error: Type of conditional expre
Given following code: using System; using System.Reflection.Emit; using System.Diagnostics; using System.Reflection; namespace ConsoleApplication1 { class A { public int Do(int n) { return n; } } public delegate int DoDelegate(); class Program { publ
I have a following line of code: var availableClients = (Controller.ListClientsForCurrentUser() as DataTable).AsEnumerable(); and I want to take advantage of LINQ's extension methods (MSDN) like Any. But those methods are not visible. What is going o
I have a call tracking application that I've built and now I need to create a Windows Installer that bundles the .NET Framework 4.0 with the installer and also allows the user to enter a authentication id, when installing the application. Then be abl
Lets say I have a class like this: public class Foo { public Foo {} public int Titi { get; set; } public int Toto { get; set; } public int Tata { get; set; } } I can initialize a new instance like this: var inst = new Foo { Titi = 12, Toto = 42, Tata
My solution has an unmanaged C++ DLL, which exports a function, and a managed application that PInvokes this function. I've just converted the solution from .NET 3.5 to .NET 4.0 and got this PInvokeStackImbalance "A call to PInvoke function [...] has
i have a list of writers. public class Writers{ long WriterID { get;set; } } Also I have two lists of type Article. public class Article{ long ArticleID { get; set; } long WriterID { get; set; } //and others } so the code i have is: List<Article> Ar
I'm trying to get the height and width of the scrollbars that are displayed on a ListView. Is there an easy way to do this? I did some google'ing and it looks like it might be a system setting. I'm just not sure where to look.Yes, it is a system sett
I'm creating a dashboard application that shows hundreds of "items" on a FlowLayoutPanel. Each "item" is a UserControl that is made up of 12 textboxes or labels. My app queries a database and then creates an "item" instance f
Say I clicked somewhere inside a RichTextBox control. How can I get the current line the caret is currently on? Btw this is to retrieve the whole text string of that line.That's what RichTextBox.GetLineFromCharIndex() does. Pass the SelectionStart pr
When I am running a WCF service on my development machine it works as long as the client is connected to the domain. When the machine is disconnected I get the following exception: System.ServiceModel.Security.SecurityNegotiationException: A call to
For many years I have used the old "SAP DCOM Connector" to communicate between Microsoft based applications and SAP. Unfortunately this old but good and performant technology is no longer supported by SAP since years. Therefore I want and must m
We are in the initial phase of trying to implement TDD. I demo'd the Visual Studio Team System code coverage / TDD tools and the team is excited at the possibilities. Currently we use Devpartner for code coverage, but we want to eliminate it because
I have an XML that I need remove empty elements from. I am trying to avoid using the DOM and am trying to do this as streams. I have this code, but I am not entirely sure how correct and optimized this is. StringBuilder xslt = new StringBuilder(); xs
When I try to start a service I created in Visual Studio I receive the following error: System error 5 has occurred. Access is denied. I am running the command line with elevated privileges, so it's not that problem. Is there any place I can look to
In .Net the Component class exposes a Disposed event. It also provides a protected member OnDispose(bool disposing). What is the best practice for a custom component that extends Component? Override OnDispose(bool) or attach an event handler to Dispo
I am encrypting the user's input for generating a string for password. But a line of code gives different results in different versions of the framework. Partial code with value of key pressed by user: Key pressed: 1. Variable ascii is 49. Value of '