This might be a bit of an anti-pattern, but it is possible for a property on a C# class to accept multiple values?
For example, say I have an Public int property and I always want it to return an int, but I would like to be able to have the property set by assigning a decimal, an integer or some other data type. So my question is if it ...
I have a group of checkboxes that all represent different selections of the same type (for my example, they are all different file types). I feel like binding each one to an individual property in the ViewModel is overkill, and I'd prefer to bind them all to one collection and use the binding syntax to bind each checkbox to a particular...
I'm developing an ASP.NET MVC application in which I want to encrypt a short string on the server, using C#, and send it to the client-side.
Then on the client-side it will be decrypted through Javascript code.
Any thoughts on how to implement this?
Do you know of a simple encryption algorithm (doesn't have to be bullet-proof secure) ...
I'm not sure how to modify the CustomRules.js file to only show requests for a certain domain.
Does anyone know how to accomplish this?
...
Hi,
What's the best/ quickest way/ approach to learn C# programming for a C++ programmer?
Thanks
...
I have a form that will be populated by a bunch of information from a template, and then handed over to the user to fill out the rest. The thing is, the template and the object that holds the eventual result are DataRows, because it's all going into and out of a database (that I have no schema control over), so this seems like a great pl...
I have a website in Sharepoint 2007. I use control adapters, specifically an adapter for the menu and the login control. These two adapters resides in a signed assembly that it is deployed to the bin folder of the website.
The browser
<browser refID="Default">
<controlAdapters>
<adapter controlType="System.Web.UI.WebControls...
Most of our development is done in vb.net (not my choice) and one frequently used code pattern uses an 'On Error GoTo' followed by a 'Resume Next' so that all database fields can be read with a DirectCast() and any DBNull values are just ignored.
The current code would be
On Error GoTo error_code
oObject.Name = DirectCast(oReader.Item(...
I would like to write an extension to the VisualStudio form designer which automatically corrects some properties of controls:
More specifically, I would like to be able to select a TableLayoutPanel, invoke some command (menu, macro, verb, whatever) and have the AutoSize, Anchor, Margin, Padding etc. properties of the contained controls...
Is the OLEDB provider managed or unmanaged?
...
I have an MVC controller base class on which I applied the Authorize attribute since I want almost all of the controllers (and their actions along) to be authorized.
However I need to have a controller and an action of another controller unauthorized. I wanted to be able to decorate them with the [Authorize(false)] or something but thi...
I want to log all exceptions server side.
In ASP.NET I write something like this in Global.asax.cs, but will this work for a WCF service, too?
public class Global : HttpApplication
{
protected void Application_Error(object sender, EventArgs e)
{
Exception unhandledException = Server.GetLastError();
//Log except...
I'm Serializing an ArrayList to a binary file in order to send it across TCP/IP. The serialized file is created by the server and I hope to be able to deserialize it with the client that I'm writing at the moment.
However, when the client attempts to deserialize it throws a SerializationException because it can't find the assembly (pres...
I generate an excel file using XML format outlined on stackoverflow in the following post:
Generate excel file in .net
However, when I open it up in excel 07, I get the following message:
The file you are trying to open,
"blah.xls", is in a different format
than spefied by the file extension.
Verify that the file i snot corrup...
I have a number of different data sources that I need to query and have been able to do confine all my queries to very simple expressions with no more than 2 conditions. An example of typical complexity of my lamba Expressions is:
b => b.user == "joe" && b.domain == "bloggs.com"
On my non-SQL data sources I'm ok as I can convert them ...
Recenty I installed resharper 4.5, It has cool new feature of checking naming convention, but with this there has been lots of warning message popping up in my aspx file suggesting to prefix all web control name with "_" as it is member field, would like to know what naming convention you prefer for web control and do you prefix control ...
Your job is to design a Project Plan class library which supports the tracking of tasks (similar to how MS Project works). This class library has a Task object (among others).
The Task object has a EstimatedHours (Double), StartDate (DateTime), and EndDate (DateTime) properties, among others. A Task object can have one parent Task, and...
Are these actually three different concepts or am I getting jumbled? (I've been reading articles about threading and garbage collection together and have confused myself.)
"Critical section" - I think this may just be the term for sections of code that you don't want multiple threads accessing at the same time i.e. inside lock and Moni...
Hi all,
public IList<T> GetClientsByListofID<T>(IList<int> ids) where T : IClient
{
IList<T> clients = new List<T>();
clients.Add( new Client(3));
}
I am getting a compiler error here:
cannot convert from 'Bailey.Objects.Client' to 'T'
The client object implements the IClient interface. My goal here is to try and loosen t...
I have a web service method where I would like to throw some custom exceptions e.g. SomeException, SomeOtherException etc which the web service would then turn into a SOAP fault which the client would be able to handle. In Java I can have wsdl:fault elements within the wsdl:operation element in the WSDL. It appears it .NET that this is n...