.net

How to replace Linq Cast expression ?

Question: I have some code for pgp encryption from here: http://blogs.microsoft.co.il/blogs/kim/archive/2009/01/23/pgp-zip-encrypted-files-with-c.aspx It has the below method, using some LINQ. I'm still on .NET 2.0 and can't switch higher, yet... How can I replace this expression with ordinary code? I don't really understand Linq, I g...

Authorising Web App users against User Information as well as Role.

Hi all, I was wondering if anyone would be able to help me with the following? I need some more complicated rules for authorisation in a webapp than just role, which I have working fine. Something along the lines of "Allow all Admins. Allow Buyers, provided they have the correct department ID and are allowed to see this customer's crede...

Split a collection into parts based on condition with LINQ?

I want to achieve something similar to this. But I don't know in what manner I can use that solution. My entity has these properties CustomerName Date SortOrder I've whole list of this Entity. What I want to do is, group all those items in List<> which have consecutive SortOrder and same Date and same CustomerName Example input v...

Can I collapse foreach, using and other c# code blocks in Visual Studio 2010?

Can I collapse foreach, using and other c# code blocks in Visual Studio 2010, the same way that I can collapse methods, properties, classes, namespaces, etc? It would be very helpful sometimes. ...

Best way to store List<Point> in a string and parse back

What would be the fastest way to store List of type Point, in a string that produces minimum string length and with fastest parse back algorithm? I found that framework has Convert.ToBase64String, Convert.FromBase64String methods. Open to any ideas using these or even better self designed algorithms ;) Thanks in advance C#, vs2005 (.n...

How do I automatically display all properties of a class and their values in a string?

Imagine a class with many public properties. For some reason, it is impossible to refactor this class into smaller subclasses. I'd like to add a ToString override that returns something along the lines of: Property 1: Value of property 1\n Property 2: Value of property 2\n ... Is there a way to do this? ...

Can OnDeserializedAttribute be used instead of IDeserializationCallback interface?

As MSDN states here, it can. But I've spent 2 hours digging mscorlib code, because in some cases the BinaryFormatter called my method marked with OnDeserialized BEFORE deserialization constructor. That is, the order was OnDeserializing(StreamingContext context) OnDeserialized(StreamingContext context) .ctor(SerializationInfo info, Stre...

Java equivalent to WPF's 3D functionalities

I've recently engaged on studying WPF (to be honest, I've gotten into it just because there was built-in 3D object, camera and rendering capabilities), which has allowed me to do this: Download: Master Maze Use directional keys ([ ↑ ] [ ↓ ] [→] [←]) to walk and turn, [Q] or [A], and [W] or [S] ("god mode") to have a broader look ...

WP7: ListBox.ScrollIntoView smooth scrolling

How can i make smooth scrolling of content into ListBox? I tried to use ListBox.ScrollIntoView but it instantly scrolls to selected item. ...

How does Snag.IT/snipping tool create captures of a window and obfuscate the background? Which dll's to use?

Hi, I have been busy creating a screen capture function in Java using JNA (java native access). So far I have been able to do a lot, but I am baffled about some things a bit. The OS is Windows, if you wonder.... I find it easy to capture, for example, a region, or a window, but find it hard to draw over it. The reason for this is the...

Saving Files in silverlight and asynchronous call backs

In Silverlight you have to save a file using the save file dialog. You can only open this dialog from a user event aka a button click I’m returning the data of a file from a web service call asynchronously How do i save this to file? If i ask them before the service call i can’t use the stream after the data comes back. If i ask the...

SQL Server Reporting Services - Functions Problem

Hi. I´m developing a app in ASPX .NET2008. And I have a big problem with the SQL Server Reporting Services. The button "Print" and the zoom option only is showed in IE browser but I need it showing in Chrome and FireFox too. I think it is a ACTIVEX problem, but I´m not correctly this. ...

Consuming Java Web Service from .NET

I have a web service written in Java now I want to consume that web service in the .NET world. I use the WSDL to add a proxy class to my .NET application but when I invoke the Java web service method the response is always null. Anyone familiar with this issue? UPDATE 1: Another thing I noted is that I opened one of the svcinfo files ...

problem with take n rows and skip m rows entity framework

Hi, Im computing data from database (~130 000 000 rows). Because of big amount of rows I select 1 mln compute them save results then select another 1 mln and so on. I use select .. orderby .. skip m... take n...ToList() because I want to have this objects in memory. When I skip 1 mln then 2 mln then 3 mln ... then lets say 6 mln its...

What advantages does one big database query have over many small ones

I inherited the app and what it does is get data from 4 views with an (xml file in it) in chunks of 1000 records then writes them down in an xml file all this split up by a type parameter that has 9 different possibilities. That means in a worst case there will be 36 connections to the database for each 1000 of that type/view combination...

Capture serialised XML when deserialising

Hi guys, .net, C# Is it easily possible (by use of attributes etc) to automatically save the entire XML string (as a string field) that was created when an object was serialised when that object is deserialised? I ask because I'm receiving an XML stub from a web service, and that stub contains a digital signature that I can use to ver...

Custom data type as parameter in WebService

I'm writing a WebService in .NET and use a custom type with no public properties. It looks like this: It is similar to the built-in type Guid but with special validation rules for MAC addresses. The SOAP description looks like this: <StringProperty>string</StringProperty> <GuidProperty>guid</GuidProperty> <MacAddressProperty /> <!--My...

Trying to use the C# SpellCheck class

Hi, I am trying to use the SpellCheck class C# provides (in PresentationFramework.dll). But, I am experiencing problems when trying to bind the spelling to my textbox: SpellCheck.SetIsEnabled(txtWhatever, true); The problem is that my txtWhatever is of type System.Windows.Forms and the parameter this function is looking for is System...

copy a file using UNC and impersonation

Hello, I want to use FileInfo and CopyTo to move some files across a network. I have to move the files to a share on a server that has to be accessed using a particular user account. How do I do this - do I have to impersonate that user and then do the copy? I am using .net 4 and was wondering what the best way accomplish the imperson...

ORM that supports Mono?

Hi, I'm starting up a rather large-scale open source server project written in C# which targets both the MS.NET and Mono platforms. However, I realized that Mono only has limited support for LINQ to SQL, and no support for the Entity Framework at all. Two ORMs I have considered are NHibernate and SubSonic. However, I have no idea how e...