.net-3.5

Reflection. What can we achieve using it?

Hi! I'm reading and learning about reflection in C#. It would be fine to know how can it help me in my daily work, so I want people with more experience than me tell me samples or ideas about what kinds of things can we achieve using it, or how can we reduce de amount of code that we write. Thanks. ...

N-way intersection of sorted enumerables

Given n enumerables of the same type that return distinct elements in ascending order, for example: IEnumerable<char> s1 = "adhjlstxyz"; IEnumerable<char> s2 = "bdeijmnpsz"; IEnumerable<char> s3 = "dejlnopsvw"; I want to efficiently find all values that are elements of all enumerables: IEnumerable<char> sx = Intersect(new[] { s1, s2,...

Add event handler dynamically having the delegate name in a string

Hi! I need to assign an eventHandler to an object, in this way: _Element.AddHandler(UIElement.MouseLeftButtonUpEvent, new RoutedEventHandler(Vars.Digit), true); but, in fact, I only have a string that contains "Digit" or other method name in the Vars object instance. It is possible to achieve this using reflection or other kind of t...

ServiceKnownTypeAttribute doesn't pop up in WSDL

I have an service Interface: [ServiceContract] [ServiceKnownType(typeof(Models.ArticleImage))] public interface IPhotoManagementService { [OperationContract] bool Login(string username, string password); [OperationContract] bool IsLoggedIn(); [OperationContract] void UpdateImage(string articleID, string selectedImage); } As yo...

how to get Compiler error message? asp.net

Hi, how can I get Compiler Error Message if a have pageUrl. I'm tried using HttpWebRequest class, but haven't get result yet. Problem that, i have collection of pages, than must execute automatically. and if page fails, create log. thank you ...

Should I keep a SerialPort connection open?

I am working with serial communication and I'm wondering whether I should keep the SerialPort open or not? I'm creating a queue of commands and only one will be running at a time. Should I create a SerialPort and open/close it in each command, or should I have another class which holds the port open and is called from the commands? Or d...

how to compare two arrays of objects

i have an object called Person. It has properties First, Last, Age, etc . . . I have two arrays of Person objects. I want to have some function to take two arrays Person[] firstlist = . . Person[] secondList = . . and have it spit out two new arrays Person[] peopleinFirstListandNotSecond Person[] peopleinSecondListandNotFirst ...

Can AppDomainSetup.ConfigurationFile be loaded from database?

I'm working on a WCF host by using ServiceHost and dynamically creating several application domains to keep my services up. I'm also planning to keep my assemblies on database and load them by using Assembly.Load(byte[]) But now I stumbled on a problem: how to load my configuration file (aka *.dll.config) from database and pass it to my...

Gridview RowUpdate behaving weird inside updatepanel

Hi, I want to update gridview row. But somehow my gridview rowcount is set to 0 on RowUpdating event. No idea whats going wrong. Please let me know what am doing wrong. Here is my code: <asp:UpdatePanel ID="updTrackerItem" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false"> <ContentTemplate> <table cellspac...

Updating relative time with WPF DataTemplate

Hi! I'm using a DataTemplate to show items (from a class via data binding) in a listbox. This class also contains date and time, and I'm using a converter to convert this date/time to relative time (xx minutes ago), which is then displayed in a TextBlock. So far everything is great. The problem is that I don't know how to keep this rela...

asp.net 3.5. grid view - visible="false" controls not getting value when calling update statement

hi, in asp.net 3.5[vs2008] Gridview i got one issue. i have binded objectdatasource with datagridview, provided Get and Update method in ojectdatasource . and in gridview i made some Bound fields visible ="false"[e.g. Primary Ke,Id, foregin Key fields which i need at time of update]. but when i did debugging, i am not getting values for ...

XAML - Generic textbox stylewith triggers / parameters?

Hello all I want to be able to have a generic style template that can switch colors of my textboxes based on a bool. But I don't want to have to create a unique style for each textbox. How do I do this? I have put some sample code below how I might expect this to work. Three textboxes, all with different bindings but attempting to use...

How can i save the screen as an image from a .NET forms application in C#

Hi, I have a .NET 3.5 Windows forms application. When the user keys in data and clicks 'Save', i want to save the entire form as an image file. How can i do this ? Thanks, Chak. ...

Style template does not reevaluate when Data updates

I have a style template (below) that does not update when my Tag binding updates. The data itself updates and I receive no binding errors so expect everything is bound correctly it is just that the style doesn't seem to update at all. I have notifypropertychanged events in all the right places afaik so doubt this is the issue. Thanks ...

Changed debug enviroment from VB6 to Visual Studio

Hi, I have already Visual Studio 2008 in my machine. Then I have installed VB6. After that when I try to debug of my .net problem through the JavaScript using the "debugger" keyword, it's open the VB6 environment. How can I change the my debug environment VB6 to Visual Studio ? ...

Terminal Services commands available in a .NET namespace?

Are there .NET equivalent commands to terminal services commands 'QWINSTA', 'RWINSTA', AND 'TSDISCON'? Thanks ...

Sql Server Reporting Services (SSRS) or Microsoft .net 3.5 Chart Controls

Under what circumstances would you use SSRS rather than Chart Controls? I'm trying to determine if it makes sense to use reporting services to produce charts for a .net project, but I'm not sure about the learning curve, potential benefits, potential drawbacks. The only benefit I can immediately see is the ability to setup reports to b...

Efficiently adding large amounts of text to a database

I have a C# app that needs to add large amounts of text to a SQL Server database (one row could have up to 1GB of text). So, I have some code that looks like: SqlParameter param = command.Parameters.Add("@text", SqlDbType.NVarChar); param.Value = new string(buffer); The text is added in chunks, so the buffer is say, 20 MB. I've tried ...

Retrieving HashSet<string> object reference

How can I efficiently get a reference to a string in a HashSet<string> if I know the string exists? i.e. hashSet.Contains(myString) == true string stringRef = ??? Thanks! ...

Extending configuration for .Net 3.5 Applications

Due to a requirement in my current project, I have to build a configuration manager to handle configurations that merge local config info with database one. Custom configuration doesn't fit my needs, problem is that I don't know what's the type before loading certain information, for example: Loading database information I will ...