I know I can:
public class SampleClass<TSerializable>
where TSerializable : ISerializable
How can I write a SampleClass that accepts only classes marked with the SerializableAttribute instead?
...
I am trying to get the full path of a file in my unit test which is in a folder in my project.
i tried using
Directory.GetCurrentDirectory();
but that returns the directory which my tests are running in. I want the directory of the project (or solution) without having to hard-code it in there. Then I can append the last part of the f...
Does it needs reflection?
...
In my application's form, I have two RichTextBox objects. They will both always have the same number of lines of text. I would like to "synchronize" the vertical scrolling between these two, so that when the user changes the vertical scroll position on one, the other scrolls the same amount. How might I go about doing this?
...
I want to parse a fraction stored in a string(e.g. "2/13") to a double. I can write the parsing code but my only question is where should this code go. Best would be if I could use double.Parse() function for this purpose. Is it possible to do it? If double.Parse() can't be used as it is how about writing an extension method? Or any othe...
I have a state machine workflow which contains a number of states. Each state has an event driven activity that handles an external event. When that event fires, I'd like to either redirect the request to a different Controller Action or a View.
What is the best way to redirect to a different view or controller action when an event is...
I think the question is clear.
...
Say I have a label inside a gridview template column and I assign the text to the databound item, "OrderID". Is there any way I can call .ToString().PadLeft(7, '0') ? Here's the label as it stands:
<asp:Label ID="lblOrderID" runat="server" Text='<%# "WW" + DataBinder.Eval(Container.DataItem, "OrderID") %>' />
Because PadLeft requir...
Situation: When I deserialize XML that contains carriage returns, the characters appear as unprintable character "boxes" rather than as carriage returns.
Background: User input collected via a multi-line textbox contains carriage returns within the text. I am persisting this text data to XML using the .NET XML serializer (snippet below...
I have the following WCF service host console application:
static void Main(string[] args)
{
ServiceHost serviceHost =
new ServiceHost(typeof(MyServiceName<int>));
serviceHost.Open();
Console.ReadLine();
}
I tried to configure an endpoint for it:
<services>
<service name="MyNamespace.MyServiceName<int>">
...
I will explain my question on an example. Let's have following code in C#:
void A(Action block)
{
B(() =>
{
Console.WriteLine(2);
block();
});
}
void B(Action block)
{
Console.WriteLine(1);
block();
}
void Main()
{
A(() =>
{
Console.WriteLine(3);
});
}
The output of this code is:
1
2
3
Now, I want to write this code...
I have a class that Im using for userdefined functions in Excel. The classlibrary is installed and available as an Automation object.
I have no problems creating functions with one or more parameters. And no problems return arrays and 2 dimensional arrays as results.
However Im trying to setup a function that can take variable paramete...
How to allow my control contains a text inside it's tags?
<uc:My runat="server">Text</uc:My>
My control contains a complex table and I want to put Text into one of cells. How to do that?
...
I have noticed an undesirable behavior with .net winforms applications. I have a wide screen monitor rotated 90 degrees to the portrait orientation. When .net winforms applications display on it, the window appears, but it is all blank, white. I can fix the window by hitting ctrl-alt-delete and when the dialog comes up, hitting cancel, t...
I'm trying to query a running state machine workflow using StateMachineWrokflowInstance in ASP.NET MVC.
Here is the scenario:
Workflow runtime configuration: added SqlWorkflowPersistenceService, ManualWorkflowSchedulerService, ExternalDataExchangeService and registered custom ExternalDataExchange service with ExternalDataExchangeServi...
How can I enable the ODP.Net Performance Counters for my web app???
I'm Using:
.Net 2.0
Oracle 11g
Windows 2008 R2
...
I am at a loss here of a best-practice to pass XML back and forth with RPG and C#.NET. Originally, I was going to use a temp physical file in QTEMP, but it seems to be that there should be a better way. The temp file has one line of the document in one record of the file. To me this seems to add a lot of extra work that really shouldn't ...
Hi,
I am using ws-discovery in .NET 4.0 and it is working well. One question I have is how to deal with services that are not working. For example, say I have IService on server A and server B. Let's say this service on server A is broken (mimic this by stopping Application Pool). Your client will still find 2 services, so when you atte...
I have a Flex-WebORB-Asp.NET application. When logging in, there's a AuthenticationHandler which implements a WebORB interface:
IPrincipal CheckCredentials(string username, string password, Request message);
So I create a Principal and return it. WebORB uses the Principal to check for Authentication and Authorization of remote method ...
Hi All,
I'm writing an HTTP client using the .Net TcpClient / Sockets.
So far, the client handles both Content-Length and chunked responses by iterating through the NetworkStream response (after writing a GET request to the TcpClient), parsing the headers and retrieving the relevant message body bytes / chunked bytes. To do this it us...