.net

Distinct list of objects based on an arbitrary key in LINQ

I have some objects: class Foo { public Guid id; public string description; } var list = new List<Foo>(); list.Add(new Foo() { id = Guid.Empty, description = "empty" }); list.Add(new Foo() { id = Guid.Empty, description = "empty" }); list.Add(new Foo() { id = Guid.NewGuid(), description = "notempty" }); list.Add(new Foo() { id...

select random file from directory

I've seen a few examples but none so far in C#, what is the best way to select a random file under a directory? In this particular case I want to select a wallpaper from "C:\wallpapers" every 15 or so minutes. Thanks. ...

Which blogging engine is used on this site?

I am looking for a blogging engine / CMS for a personal website to post .NET articles. I came across a blog that has a really nice layout and very appealing way of posting code. Anyone knows which blogging engine it uses? Blog Any other recommendations will be really appreciated. ...

select random file from directory

Any suggestions on how to improve this method? I am currently using it to select a single wallpaper from a directory of wallpapers I know your not supposed to use arraylist anymore but i couldnt think of a altrnative also im not sure how to filter for more than just one type of file (ie jpg gif png) in the directory info. any suggestio...

Enabling Intellisense for Custom Sections in .config Files

When editing .NET config files (app.config, web.config, etc) in Visual Studio, I get Visual Studio's intellisense to guide me when choosing my application's settings. If I add a custom configuration section, how can I enable intellisense for my custom settings? I'm sure there must be an easy answer to this, but a cursory Google search di...

triggering events "over the wire" in .net

I need a way to trigger events on remote processes "over the wire" and pass parameters (xml serialization, whatever). I want to be able to do things like this. foreach(childClient c in clientList) { MyEvent += c.EventHandler; } MyEvent("param"); what technologies are good for this? WCF? This is a small deployment in house softwa...

Will string.Trim() ever remove *valid* characters from a filename?

I'm creating a class to store a filename. To do so, I need to know exactly which characters are invalid and exactly which characters are invalid as leading/trailing characters. Windows Explorer trims leading and trailing white-space characters automatically when naming a file, so I need to trim the same characters when constructing a f...

Which FIPS compatible algorithm is better in dotNet 2.0?

I used Rijndael algorithm to encrypt/decrypt my data. But it is not FIPS compatible. I want to change it to another one. Could you please give me a suggestion that which one is better? Better means: FIPS compatible High security level This algorithm should came from dotnet 2.0 framework which provided by Microsoft. Thanks -Jamebo ...

Can I download files from a folder with a Password?

Hi All, t get a password to enter,this folder get a password (of course i insert the password ) because its deny access and to be canceled from person without permission so i'm looking how download files from that folder with C# . Before i tried to download files but Visual Studio got an error: "Access Denied"! Do you have any advice ...

IExtension : extensible object pattern : How does it work?

I was exploring about Extensible object pattern using (IExtension, IExtensibleObject) interfaces in C#, I came with a very simple example to convert dates to UTC from local and vice-versa: public class BaseObject : IExtensibleObject<BaseObject> { private DateTime _startDate; private ExtensionCollection<BaseObject> _...

Is scala.net production ready?

Scala seems to have a .net implementation too. I was wondering if it's a complete implementation with no lose ends or just a showcase thing. It's important because the app we are about to develop should have Windows GUI besides the main implantation on web. Having a language where the core code can be ported between two implantations lo...

what is the namespace i need to use to declare a class like the following....

public __gc class test :public MarshalByValueComponent,IListSource,ISupportInitialize,ISerializable can any one help me plz.... ...

How to instantiate a managed class in c++ (DATATABLE)?

Hi i am creating a Datatable in C++ as follows when i try to create the instance i am getting a compile time error as cannot creating instance for abstract class. here i am not usng any abstract keyword. #include "stdio.h" #include "conio.h" #using <mscorlib.dll> using namespace System::Data; using namespace System::ComponentModel; usi...

Selective resource compiling in .NET?

How can I choose which resources to compile depending of the compile constants used? So, if VAR1=0 then I wouldn't add RESOURCE_A to my final assembly. I searched around, but didn't find any info regarding this... I guess I'm using the wrong keywords, since I doubt nobody else had this problem/doubt ever before. Also, I use both VS2005...

Best way to handle a email lists in .Net

In our project there will be a 5-6 groups of mail list that we will need to send notifications(100k-200k emails). What is the best way to do this in .Net? Use custom classes, and custom smtp server? Or use some third party service(I don't find anything like that). PS:We have 2 dedicated servers with win 2003 on them. ...

Migrating from 'native' OODBMS to ORM (Entity Framework / SQL Server)

A while ago we started developing a new project which internally has about 25-30 different classes/types/models that are heavily related to each other either via 1:n, n:m or n:1 relationships. Back then we went with a native .net oodbms system basically because what it allowed us to do was to take our object model and simply add a few p...

ASP.NET MVC Default Parameters

I have created a new route like the following: routes.MapRoute( "BlogYMD", "blog/date/{year}/{month}/{day}", new { controller = "Blog", action = "Date", year = "2009", month="01", day="01" }); The view simply returns a concatenation of year, month and day. This works fine for URL's like: http://localhost/blog/date/2...

.NET HTTP parser

I am writing an application to sniff some HTTP traffic. I am using WinPcap to access the TCP/IP packets. Is there a library that will help me parse the HTTP messages? I have implemented a basic parser myself, but I would like something more mature: I keep running into new variations (chunked messages, gzip-compression etc.) The .NET fr...

How can I determine whether Console.Out has been redirected to a file?

If my program is printing to the console, I perform word-wrapping in a certain way according to Console.WindowWidth by inserting newlines - and this works perfectly. However if the output of the program is redirected to a file or another program I would like it to skip the word-wrapping. How can I detect when this is the case? Console....

My IsConnected always returns true.

Test-cases: Before connection starts it should return false Connection is closed by other end return false Connection is closed by the client return false Connection exists even if no data is avaliable return true class MyConnection { //Assume I have all initialization for _socket public bool IsConnected() { retu...