I was creating a http module and while debugging I noticed something which at first (at least) seemed like weird behaviour.
When i set a breakpoint in the init method of the httpmodule i can see that the http module init method is being called several times even though i have only started up the website for debugging and made one single...
In the white paper, it said that we can use REST to ask for the token then use the token to attache to the request we are going to fire, then can invoke the service in the service bus, how ever, i cannot get the token
Bellow are the codes i use to make REST call, i can get the result, but which was a html error page..
i didn`t get any t...
I have 2 assemblies:
Assembly 1:
interface IWeapon {
int Might { get; }
}
[Export("sword")]
public class Sword : IWeapon {
public int Might {
get { return 10; }
}
}
Assembly 2:
interface IWeapon {
int Might { get; }
}
var catalog = new AssemblyCatalog(typeof(Ninja.Sword).Assembly);
var container = new C...
I am attempting to write a C# component which will expose events. The component is to be imported by an unmanaged C++ application. According to a few tutorials I have come up with this code (for the C# side):
namespace COMTest
{
[ComVisible(true),
Guid("02271CDF-BDB9-4cfe-B65B-2FA58FF1F64B"),
InterfaceType(ComInterfaceType.InterfaceIsID...
I need to derive an important value given 7 potential inputs. Uncle Bob urges me to avoid functions with that many parameters, so I've extracted the class. All parameters now being properties, I'm left with a calculation method with no arguments.
“That”, I think, “could be a property, but I'm not sure if that's idiomatic C#.”
Should I...
In .Net, given a type name, is there a method that tells me in which assembly (instance of System.Reflection.Assembly) that type is defined?
I assume that my project already has a reference to that assembly, just need to know which one it is.
...
I am about to start making a simple little video editing application, and I was trying to decide what system to create the GUI in. I know a lot about the Windows API, and actually, all of my programs thus far have been written in it. I would really like to use the new WPF framework though; however, I am a bit concerned about the fact t...
In straight SQL, I'd probably wrap some logic over a simple join, but how would I do this efficiently in LINQ to SQL? Imagine I have two tables:
Parent
ID
Child
ParentID
ID
Name
Ideally I'd like a graph of Parent objects with a "Childs" property that is actually a Dictionary<int, string>.
Suggestions?
...
Lets say I have two classes:
class A
{
[SortOrder(3)]
public string Name { get; set; }
}
class B : A
{
[SortBefore(*****)]
public string Age { get; set; }
}
Note the stars in the property attribute in the second class. Would it somehow (using expressions I guess) be possible to specify A.Name in the SortBefore attribute? ...
Had the idea I'd seen at least one.
...
I need to detect if an object was created anonymously like new{name=value,}
if it is an AnonymousType, it should add it's properties names/values into a
Dictionary<string,object>
This is what I hacked together myself:
var name="name";
var obj = new { name = new object(), };
var lookup = new Dictionary<string,object>();
if(obj.G...
I've found this, but it doesn't look very much complete. Also, the description in Visual Studio about the events is mostly ambiguous. I don't want to go on a trial and error rampage to find things out.
I'm particularly interested in the events related to exit/abort from a Form.
EDIT: I know events are part of the framework and not spe...
I have a 3 letter ISO code (e.g. DEU for germany, USA for America...) and would like to get the GeoID as listed in this table, also available here How can I do that using either straight .NET, P/Invoking or through the MapPoint PIA.
e.g. given "SWE", I would like to retrieve 221.
System.Globalisation.RegionInfo looks kinda promising - ...
Hi
I'm learning events in C# and am having difficulties understanding why exactly is the EventArgs class that carries data about the event necessary. E.g. in this sample couldn't the WakeMeUp class read all the necessary data(snoozePressed,nrings) from AlarmClock fields? If it can set them, why couldn't it get them?
Thanks in advance.
...
Hi,
i am using ASP.NET MVC & ADO.NET Entity Framework in a project. I want to add validation logic to my entities via partial classes. It works similar like shown in the NerdDinner.com ASP.NET MVC Application which is using LINQ2SQL. The main difference is, that i have to use the"OnPropertyChanging" event instead the "OnValidating" like...
I want to have ONE instance of an image list that I want to share over all the forms in my application(s) (icons for the toolbar). I've seen the question asked before and people came up with a user control (which is no good, since it will create multiple instances of the imagelist and thus create unnecessary objects and overhead).
Desig...
I've attached to a running .net 1.1 application using Visual Studio 2008. I have the debug symbols and the code on the local machine. If an exception occurs, the code pops up fine. However I can't work out how to view the code and set a breakpoint pre-emptively.
Is there a trick?
...
Hi,
Is it possible to restrict a .NET executable to a specific machine somehow so that it can only be run on that machine.
...
Strange and probably trivial problem. I have three projects in one solution (.NET 2.0, Visual Studio 2005, C#). The first one produces GenericService.dll which contains one abstract generic class called GenericService:
public abstract class GenericService< T > { }
The second one is ServiceImplementation.dll which contains ServiceImple...
I would like to create an console exe application, that may be run as a standalone application as well as a windows service. Is it possible to do? What are actually the benefits of using svchost?
...