.net

What was the name of the set accessor that only lets the value to be set in the constructor?

public class MyClass { public string Name {get; KEYWORD set;} public MyClass(string name) { this.Name = name; } } Any ideas what the KEYWORD was? I searched all over but it's hard to find the get/set accessors in google. ...

.NET Async TcpListener / TcpClient Question...

I'm at a bit of a loss as to how to properly implement the asynchronous methods for TcpListner and TcpClient int .NET. I've read over quite a few posts on hear and I believe I have the code to accept new clients on the server taken care of. Here is the code for acception new connections: Public Sub Start() m_oListener = New TcpLis...

How to represent a .NET DateTime 24-hour format in 01-24 instead of 00-23?

I have a strange business requirement to output dates as 01:00 through 24:00, instead of the usual 00:00 through 23:00. It is really a crazy requirement, but unfortunately I don't think I can avoid it. This will be a configuration option in our software, so I'll still need to support the normal 00-23 as well, so I'm hoping I can do thi...

Importing a TXT file to a DataTable so it matches how Excel imports it - C# .NET

I have a txt file, and I can import it into Excel with the following settings perfectly: Type: Delimited Delimiters: TAB Text Qualifier: None I tried loading it into a DataTable by reading the input file into a String[] array, and then splitting that String[] array. However how do you represent a TAB when splitting a string? Is this...

Using property grid to modify windows form properties

Hello, I an using a property grid to display the various properties of my custom form which the user can then modify. When I set the selected object to my form, it works, but it display all the properties of the form, Is it possible for me to define which form properties I want to display? ...

How to process multiple accounts with OAuth?

I have an application that posts to multiple Twitter accounts by storing an array of usernames and passwords. Recently, Twitter updated their API so I have to authenticate using OAuth instead of storing credentials. How would I make the user authenticate for multiple Twitter accounts during a single process? For example, I have a textbo...

What is the best OAuth2 C# library?

It seems like many app providers are using OAuth2 to allow API access, such as Twitter and Facebook. Does anyone use a good library to do OAuth2 processing that is general enough to use across all applications? ...

authentication/authorization for silverlight 4 with RIA service + Entity Framework

Hi On my current project, i need to have a login/logout and some authorization in order to let certain users from different companies access different View screen on the silverlight application. And do some operation on it Can you tell me where i can find the information for authentication/authorization by using RIA service with silver...

Is it possible to write a recursive IEnumerable<T>

I have a class like: class Spline int ChildrenCount; Spline GetChild (int index) class SplineCollection : IEnumerable<Spline> Spline Master Is it possible to write a recursive IEnumerable for the SplineCollection where it will return all the children one by one? EDIT: So Master is the root Box, and the hierarchy of its c...

WinDbg to debug System.IO.IOException

I have a full dump file from a custom exe crash. When i review the threads, i see System.IO.IOException and print exception gives me the below error. I suspect there is some sort of thread racing leading to this since we are on a vanilla Windows2008 (x64) server that doesn't have any virus scanners or indexing services installed. Any ide...

Search engine against IEnumerable objects

Hi, We have a .NET application on which has grown beyond what we can develop in-house to search. We can certainly try to make the best search algorithm we can be it's not what we do and someone else has certainly done it better. We have an IEnumerable of object which has a title and a description and we'd like to search and rank it b...

How Do I Find The Owning Assembly Of An Object In C#

I'm trying to do some processing on all assemblies that own forms that are currently open in my application. I can easily get the form objects with: System.Windows.Forms.Application.OpenForms I want to iterate through this list and find the owning assembly for each instance. I know how to find the assembly that owns a given form cla...

Sending Email error reports from windows desktop application

I have a windows desktop application running on clients machines using .NET 4.0. When an error occur, The application catches it and needs to send it to the support team b email. The question is how to send an email with the full stack trace (including stacktrace for inner exception if there is one) using email? I tried using the "Mail...

Question about terminating a thread cleanly in .NET

I understand Thread.Abort() is evil from the multitude of articles I've read on the topic, so I'm currently in the process of ripping out to of my abort's in order to replace it for a cleaner way; and after comparing user strategies from people here on stackoverflow and then after reading "How to: Create and Terminate Threads (C# Program...

FtpWebRequest working with Explicit TLS/SSL

Hi, I am trying to transfer file over explicit TLS/SSL. Looks like the FtpWebRequest in .NET upto 3.5 wouldn't working either I enabled UsePassive or not. If it is disabled, I think there are firewall/router configure to deal with (for Active mode), which once the application deployed on client's machine I don't have any control and mo...

.Net Socket Server Page Faults

I have a vb.net asynchronous socket server/listner service that is showing extremely high "Page Faults" in the task manager. Can I please have some feedback as to what this implies and how do I go about resolving the issue? Thanks for all feedback. ...

Simulate Socket Hard Disconnect

I have a C# app where a server and some clients communicate from different machines using sockets. Most of the time, the server detects a dis-connect correctly when it receives 0 bytes in the sock.Receive(...) call. But when there is a hardware issue (say a network cable is unplugged), there is a problem. One server thread continues t...

How does this .NET code work?

Hi folks, this code is part of NBuilder. I'm having a bad day .. and to prove it, I don't understand what this (simple) code is trying to do. Here are the answers, with the code after it. GetRandom.Phrase(5) == null or et or ut or do or elit or amet.. (nothing over 4 characters) GetRandom.Phrase(4) == null or s...

Is there a limit on a user setting size in .NET application?

I would like to serialize my object with many values as string(xml) into user settings. Is there a limit on how large a "string" user setting can be in a .NET application? I am extending ApplicationSettingsBase to save my settings. ...

Convert Perl MD5 Digest and Create to PowerShell

I am trying to convert the following in Perl to PowerShell, I am stuck on the MD5 Digest and Create. timestamp=1283473470 key='this-is-my-key' secret='secret' perl -e "use Digest::MD5 qw(md5 md5_hex); print md5_hex('$key' . '$secret' . $timestamp);" For testing purposes I am setting the time stamp to a static number. That way I can c...