.net

C# - How to get certain generic types from an assembly using linq

I'm trying to find types in an assembly that are of ISomeInterface< AnyType > using linq. How do I do this? Here's what I have: AppDomain.CurrentDomain.GetAssemblies().SelectMany(a=>a.GetTypes().Where(t=> /* t is ISomeInterface<ofAnyType> */)) ...

problem regarding assigning numbers to an enum variable.

Hello there, I've created a simple enum in C# as follows enum Direction { North, South, East, West } Now I'm creating a variable of this Direction enum as : Direction D = (Direction)3; Console.WriteLine(D.ToString()); Every thing goes fine and code works as expected and gives the following as output. West but no...

3 forms Show and ShowDialog not working as expected, BUG?

I am using Visual Studio 2010, C# .NET 4.0. I have 3 forms: Form1, Form2, Form3. In Form1 I have a button to open Form2: private void button1_Click(object sender, EventArgs e) { Form2 f = new Form2(); f.Show(); } In Form2 I have a private Form3 variable always pointing to the same Form3: private Form3 f = new Form3(); And ...

Autosize WPF Control

I create the following WPF control a dot and a description label: * North Star <UserControl x:Class="StopPoint.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/...

.NET user control for use in a web browser and prevent design time use

Hello, I created a .NET user control that will be installed on a user's pc via cab file. the cab will be signed with my company name and will register the .net component on the user's machine. I would like to make sure that users do not take my .net binaries that are on their pc and use them at design time in 'ANY' IDE .. With ActiveX...

How to get list of all forms of my application

I have a winforms application with multiple Forms open where only the mainform shows up in the taskbar. For the other forms I have used ShowInTaskbar = false. Let's say another application is the top window so I can't see any of my application windows When clicking my application icon on the taskbar I want all my forms belonging to...

fxcop fails because of references on obfuscated assemblies

Hello I need to run fxcop on a project that references an obfuscated commercial assembly (from dotnetremoting.com). Fxcop tries to load the obfuscated assembly and fails... I have got exactly the same problem with Mono Gendarme. It also tries to analyse referenced assemblies and fails. Thanks in advance for your responses Alex ...

using AOP in web context and affection on performance

Hi I have a web application running most of my services through web services. first i want to know how much degradation in performance would take place using AOP in web context for example if i can handle 200 request/second without AOP, what would be the result with it (having simple logging and authorization) Is there any great AOP f...

What are different middleware products in .net

Hello, what are various middleware products in .Net? Can WCF be called middleware ? ...

Events and delegates, how do I code it 2 levels deep?

Class1 creates and calls a method in Class2. Class2's method updates it progress to an event handler in Class1. But now Class2's method needs to call a method in class3. How can class3 update it's method's progress to class1? Do I need to daisy chain the events and delegates all the way down each level? (I'm using the MVC pattern, The U...

Unboxing does not create a copy of the value. Is this right?

I was reading Microsoft's Class Room Training Materil. I read the following Unboxing Unboxing is the opposite of boxing. It is the explicit conversion of a reference type to a value type. Unboxing retrieves a reference to the value type contained within an object. An unboxing operation involves checking the object instance to ensure tha...

ResourceManager not selecting correct resource set when using custom culture

I have created a localized MVC website using the code found on this blog by Alex Adamyan. This is working great if I use an existing culture. However, I am trying to localize for Tagalog (tl or tl-PH). Windows does not have this culture built in so I have created one (I have tried both tl and tl-PH) as per the code below: public stat...

.NET Threading - Quick question

What should I put instead of the "SomeType" in the below function? Delegate seems to be wrong here.. public static void StartThread(SomeType target) { ThreadStart tstart = new ThreadStart(target); Thread thread = new Thread(tstart); thread.Start(); } EDIT: I'm not looking for alternative ways to write this. ...

Why are .NET timers limited to 15 ms resolution?

Note that I'm asking about something that will call a callback function more often than once every 15 ms using something like System.Threading.Timer. I'm not asking about how to accurately time a piece of code using something like System.Diagnostics.Stopwatch or even QueryPerformanceCounter. Also, I've read the related questions: http...

Excel calculation problems

I have Excel .xlsx document in which I need to import some values to cells with defined names. Few of those cells are formated as currency and values that I'm importing in those cells are of decimal type which I import in this manner: cell.CellValue = new CellValue(value.ToString().Replace(",", ".")); In the same spreadsheet there are...

.NET [LicenseProvider(typeof(LicFileLicenseProvider))] and LicenseManager.UsageMode

Hello, I started using the .NET licenseProvider to add licensing for my net user control that can be used in a web page. In my user control's constructor I check if the control is being used in DesignMode or RunTimeMode : bool designMode = (LicenseManager.UsageMode == LicenseUsageMode.Designtime); As soon as I start using the [Licens...

Web service returning ajaxified results

I am hoping someone can point me in the right direction here. I am trying to create web service that will return ajaxified results. Specifically, I want to write a web service that will fetch email through a secure connection. However, rather then have the web service return every single email, I just want to fetch maybe 5 emails at a ti...

Handling Transactions in DAO with an Injected iBATIS.NET SQL Mapper

I am currently using iBATIS.NET for a small application I am building. I like to create concrete Classes for my DAOs instead of using ISqlMapper directly and invoking named SQL statements. I am not using a Dependency Injection container of any sort, so ideally I have my DAOs set up as follows: public abstract class AbstractDAO { ///...

Can't figure out how to add logging to my windows service!!!

I've been messing with this all day and have still not found a solution. I have created a windows service that is supposed to log to it's install directory (Program Files/Service/LOGS/) But when I run my service it doesn't do what I would expect it to do and it doesn't log anythying. I'm having a hell of a time figuring out what the p...

Pulling data from Repeater with EnableViewState=false ... How/Alternative?

Gurus, So I am trying to avoid enabling EnableViewState... Sample code as you can see has 1 repeater and 2 textboxes inside. I bind the textboxes at page init. After a postback I want to get the updated data from the client & save in a db. The Request.Form contains the data keyed with autogenerated client ids but the repeater has 0 i...