Hello.
Sometimes there is a need to initialize the singleton class with some helper values. But we can't "publish" a constructor for it. What is the workaround for this?
Attention!
overloading the GetInstance or setting a color is not my idea. The color should be set only once. I would like to be sure that MyPainter paints ONLY with th...
Hello everyone,
I am using VSTS 2008 + C# + .Net 3.5 + IIS 7.0 to develop an ASP.Net web site. I want to develop an Http module, which could inspect whether incoming request has some specific http header (e.g. CustomerID) and if do not have such header, I will redirect user request to some other pages.
I think I should develop by using...
I tried with no success:
webBrowser1.Document.ExecCommand("alert('Hello World!')", true, null);
also tried:
private void webBrowser1_DocumentCompleted(object sender
, WebBrowserDocumentCompletedEventArgs e)
{
webBrowser1.Document.InvokeScript("alert('Hello World!')");
}
...
I've got a C# program that needs to pass a char buffer to an unmanaged function. I've found two ways that seem to work reliably, but I'm not sure which I should choose.
Here's the unmanaged function's signature.
extern "C" __declspec(dllexport) int getNextResponse(char *buffer);
The first option is to define the buffer as a StringBui...
I have a program that has many settings in it's myApp.exe.config file. Because of specific hardware requirements, I must develop, test, and maintain my program on the client's machine that will run the software once I've completed it, after which I remove my source code.
Eventually the client will change app settings to suit their needs...
I am starting a project to create an "object versioning" feature for our software (.NET 3.5 / SQL Server 2008), basically it needs to do this:
a user is looking at a customer:
last name is "Smith-Johnson"
2 addresses (saved in different table)
1 product purchased
1 employee contact (saved in different table)
200 mails (saved in differ...
The following code prints (when invoking MyMethod):
0
0
0
1
I would expect it to print:
0
0
1
1
Why is this?
Code:
private struct MyStruct
{
public MyInnerStruct innerStruct;
}
private struct MyInnerStruct
{
public int counter;
public void AddOne()
{
++counter;
}
}
public static void MyMethod()
...
I'm ready about Memory management in C# from the book "Professional C#"
The presence of the garbage collector
means that you will usually not worry
about objects that you no longer need;
you will simply allow all references
to those objects to go out of scope
and allow the garbage collector to
free memory as required. How...
Hi,
I am new to XML I am receiving the following file/string. How can I break it in C# so I can put each of the fields in my SQL server Database? BTW I don't know how to format XML in StackOverflow if somebody can tell me how to do it. I'll do it.
<?xml version='1.0' encoding='ISO-8859-1'?>
<SystemGenerator-Document>
<TN>42</TN>
...
We are rewriting our app to make it Windows Vista/7 compliant. In order to do that, I need to delete all the previous data in the application directory under %PROGRAMFILES%. This definitely will not work in user mode, and also doesn't appear to work programmatically in admin mode. I am trying to use the following line of code:
File.D...
So here's the deal. I've got my solution which has a few projects in it:
A wrapper project - this is just a console app that's currently standing in for a windows service during debugging.
A worker project - this contains the guts of the code. This way I can easily debug the code for the windows service without the headache.
A plug...
The examples for Cache.Add uses DateTime.Now.Add to compute the expiration, i.e. it passes:
DateTime.Now.AddSeconds(60)
as the value of the absoluteExpiration parameter.
I'd have thought that computing it relative to DateTime.UtcNow would be more correct [as there is no ambiguity if Daylight Savings Time starts in the intervening ti...
I am developing an application in which I would like to let the users design some forms and decide the fields that are in the form.
An example is better than a poor explanation, so let me put the example of Microsoft CRM in which you as end user can define a form, the fields in that form, or customize existing forms by adding or removin...
I am continuing on from a previous question relating to loading instances of plugins specified in the app.config.
I'm curious if it's possible to add a plugin without requiring a reference added to my project and if so, how do I go about that?
<configuration>
<appSettings>
<add key="Plugin" value="Prototypes.BensPlugin, Prototype...
Hallo everyone,
i have a list of nodes ListNode and i want to draw a line between two nodes if there is an edge / link between them. My approach so far is:
public void drawGraphInBIM(ref BIM bim)
{
foreach (Node nodeOuter in ListNode)
{
foreach (Node nodeInner in ListNode)
{
if (areNodesLinked(nodeOuter, nodeInn...
I can't seem to find an answer on this and just want to make sure it's an ok coding standard. I have Interface A that is used by many different classes and don't want interface A to change. I came across a new requirement that will require an enum to be needed by many of the classes that Implement Interface A, but not all the classes n...
I find myself very intrigued by the existence of a ConcurrentBag<T> class in the upcoming .NET 4.0 framework:
Bags are useful for storing objects when ordering doesn't matter, and unlike sets, bags support duplicates.
My question is: how might this idea be implemented? Most collections I'm familiar with essentially amount to (under...
How can I set and delete cookies for a domain in webbrowser control without using Javascript (which doesn't allow to set / delete cookies without navigating to the website first.)
...
All in the question really, but I'm looking for real world experience of using Nester beyond simple cash-machine sample programs.
Does it really help improving the quality of tests?
Do you end up with fewer bugs in production?
Do you get many false alarms (say both paths through a condition can end up giving the same result for more c...
I'm working on a project with 2 other developers and I need to host it online. I need a site to host it for me with features such as version control, and others neat features.
can you suggest any ?
the project is not an open source one.
thanks.
...