Given the following client code:
var obj = new Class1();
Is there any way to modify the constructor of Class1 so that it will actually return a subclass (or some other alternate implementation) instead?
I would like obj to get one of two different implementations, depending on some condition. Obviously, I could change to using a fac...
I'm pretty new to web programming, reading a book on ASP.NET, and I notice the author does this;
<asp:ScriptManager ID="ScriptManager1" runat="server"/>
Instead of what Visual Studio does, which is this;
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
Is the first way of doing it an acceptable and multi-...
I'm using XML Writer to create a log of some important events in my application.
Currently it all works fine assuming that the application is correctly closed, but if it isnt, the file isnt closed and the log is basically lost.
Let's assume the writing of a simple element, something like this:
writer.WriteStartElement(eventName);
wr...
Well, the "Endianness" theme was always a little bit confusing to me, but i have never faced any problems which required me to even think about the default behaviour of binary writers/readers that i used. I am writing a PNG decoder in c# right now. PNG file format specification states that all numbers are stored in a big endian notation ...
Hi,
I'm trying to do some work with C# and XML in a cross-platform app (most development is in MonoDevelop on Linux, but most users will end up using the WinForms front-end that I make in Visual Studio). Mono is behaving as I'd expect, but .Net isn't and so I'm looking for options and alternatives.
The schemas have various optional ele...
I'd like to use object database to persist some classes created in IronPython. The database is db4o for .NET 2.0 (downloaded today). The code looks like this:
import clr
clr.AddReferenceToFileAndPath(r"C:\dev\Db4objects\db4o-7.12-net20\bin\net-2.0\Db4objects.Db4o.dll")
from Db4objects.Db4o import *
db = Db4oFactory.OpenFile(r'G:\IronPyt...
I need to intercept when the system tries to access to a file, and do something before it happens.
...
This is a duplicate of: Why IEnumerable<T> inherits from IEnumerable?
IList<T> implements IList. (Edit: No it doesn't; I knew this - not sure why I wrote it.)
IEnumerable<T> implements IEnumerable.
But ICollection<T> does not implement ICollection.
What was the rationale for this and/or was it just an oversight?
...
We have quite a bit of reusable code at work (a good thing). Whenever I create a new project that use them I am used to include their projects as part of my solution, and I was wondering if I should instead reuse them as published dll's instead. The reason (or excuse) I include the project is that if I find a bug in one of them I can bra...
Hi guys,
How do you SortDictionary by value (.NET 2.0)? Or is there any alternative to this?
I am trying to sort Tags just like in blogger. But I want to sort the Tags by number there were used, not by name?
...
I have an application written using the M-V-VM approach.
The data access is done in the Model. If a fatal error occurs here (for example, the connection to the data source is lost), and Exception is thrown. This Exception bubbles up to the ViewModel.
However, because the original trigger of the data access was a data binding, WPF swall...
i've a question over here regarding the .Net framework technology and the gaming server. supposely, i've a few game machine acting as a client and i want to connect those client machine to a gaming server, do you guys think it is good if i develop the server application using the .NET framework?
the client machine is also developed in d...
ASP.NET MVC 2.0: Simple Model Binding not working/binding as it should
i have a simple custom object names Comment (linq to sql generated one), it has various values, but only two values are being sent from a HTML POST from to my action, and here is my action that accepts them...
Function InsertComment(ByVal Comment As Comment) As Act...
i want to set length of the textbox as 8. when the length is 8 keys become disabled. and also backspace enable.
...
which one has better performance when copy a block of byte?
...
why c# not allowed operator overloading while C++ do?
I got this error, when trying to overload.
Overloadable binary operator expected
My sample code looks like,
public static MyClass operator +=(MyClass obj1, MyClass obj2)
{
...
}
...
The C# WebClient.UploadFile(string, string) sample on MSDN shows how to make it work with an ASPX page handling the upload. However I have a Apache server with PHP set up to handle my subversion repos. I have very little web programming knowledge, but would like to know...
Can my Apache/PHP web server handle a file from a c# client usin...
what is the advantages of using strong named assemblies. What are the thing that can't be done without normal assembly.
...
I am just wondering if it is possible to P/Invoke a pure C++ library, or does it have to be wrapped in C?
...
I m drawing rectangle on mouse move in c#,
i wrote the code like this,
onmousemove:
Rectangle rect = new Rectangle(
Math.Min(mouseMovePoint.X, mouseDownPoint.X),
Math.Min(mouseMovePoint.Y, mouseDownPoint.Y),
Math.Abs(mouseMovePoint.X - mouseDownPoint.X),
Math.Abs(mouseMovePoint.Y - mouseDownPoint.Y)
);
graphics....