Webclient.Uploadfile
I have an app that uploads files to server using the webclient. I'd like to display a progressbar while the file upload is in progress. How would I go about achieving this? ...
I have an app that uploads files to server using the webclient. I'd like to display a progressbar while the file upload is in progress. How would I go about achieving this? ...
I'd like to use interception with Unity, here is my code : UnityContainer container = new UnityContainer(); container.AddNewExtension<Interception>(); container.RegisterType<T, T>(); container.Configure<Interception>().SetDefaultInterceptorFor<T>(new VirtualMethodInterceptor()); return container.Resolve<T>(); If T is a class with a co...
I'm trying to determine if the MethodInfo object that I get from a GetMethod call on a type instance is implemented by the type or by it's base. For example: Foo foo = new Foo(); MethodInfo methodInfo = foo.GetType().GetMethod("ToString",BindingFlags|Instance); the ToString method may be implemented in the Foo class or not. I want t...
Hello all - I thought I knew this, but today I'm being proven wrong - again. Running VS2008, .NET 3.5 and C#. I added the User settings to the Properties Settings tab with default values, then read them in using this code: myTextBox.Text = Properties.Settings.Default.MyStringProperty; Then, after the user edits the value in the opt...
Here's the problem. The code below works fine on my development PC, but when I deployed the app, it crashes. Here is the lines of code that are relvant Private TdsTypesList As List(Of TDS_Type) ... TdsTypesList = (From tt In db.TDS_Types Select tt).ToList This is the error I get Exception Source: Anonymously Hosted DynamicMeth...
Hi there, I was wondering what is the best way for getting the generic arguments that definine a dictionary at run time is. Take for example: Dictionary<string, object> dict; How at runtime can I find out that the keys are strings? Thanks ...
I've seen this on occasion in books I've read. But I've found no explanation. for (;;) { // Do some stuff. } Is it kind of like "while(true)"? Basically an endless loop for polling or something? Basically something you'd do until you intentionally break the loop? ...
I would like to perform a test if an object is of a generic type. I've tried the following without success: public bool Test() { List<int> list = new List<int>(); return list.GetType() == typeof(List<>); } What am I doing wrong and how do I perform this test? ...
Hey everyone, I have a .Net app that's compiled as "Any CPU". I am running it on a x64 OS so it's running as 64bit. The application loads other assemblies that the user provides. It uses reflection of course to read types from the user provided assembly. Everything works fine if the user assembly is compiled as "Any CPU". But if the ass...
Hi. I have an XML that I need remove empty elements from, I am trying to avoid using DOM and trying to do this as streams. I have this code, but I am not entirely sure how correct and optimized this is. StringBuilder xslt = new StringBuilder(); xslt.Append(@"<?xml version=""1.0"" encoding=""UTF-8""?>"); xslt.Append(@"<xsl:stylesheet ver...
We have a Microsoft.Win32 Namespace but is it guaranteed to work in 64-bit Windows environments? Is there an equivalent need to have such definitions for a 64-bit situation? ...
Quite often I run into items in the .NET framework that have little or no code examples on how to use the features. On other occasions, there are plenty of examples, but none of them seem to work as prescribed. Case in point: The System.Diagnostics.ConsoleTraceListener class. From everything I've read and every code example I've seen, ...
I have a web reference proxy built up by the "Add Web Reference" feature in Visual Studio and need to trace/see the actual content it's posting to the remote web server. Can someone please tell me how I can do? Thanks! ...
Let's take the following two classes: public class CollectionOfChildren { public Child this[int index] { get; } public void Add(Child c); } public class Child { public CollectionOfChildren Parent { get; } } Child's Parent property should always return the CollectionOfChildren that the Child is in, or null if the child is ...
Hi All, I am using the Entity Framework just to create classes that can be mapped to database tables. We have our own data access layer that I need to go through, which is why I'm only using the generated classes. I would like the entity framework to generate foreign keys as properties instead of classes. So, basically, when it gener...
I have been a .NET developer since I started coding. I would like to learn Win32 programming. Need advice on where to start. What are the best resources /books for learining Win32 programming. I know a bit 'college C++'. ...
Hi, I am using C#2.0 and working on Winforms. I have two applications(app1,app2). when the app1 runs it will automatically invoke the app2. I have a timer in my app2 and in timer_tick I activate a buttonclick event.But I want this Button Click to be fired only one time when the app is started. The problem i am facing is for some unk...
The following code is just made up, is this possible to do with C#? class A { public int DoStuff() { return 0; } } class B { public string DoStuff() { return ""; } } class MyMagicGenericContainer<T> where T : A, B { //Below is the magic <------------------------------------------------ ...
Hi I have a Posts class and that post can have one file and that file can have many tags I want to iterate through the files in a post and show all the files tags foreach(File f in Post.Files) { f.Tags } What do I need in this foreach to get the top tag? there will only ever be one. i tried f.Tags.Select(n => n) with no luc...
C#: How to effectively filter (hide) ListView Items while in virtual mode? I am looking for a way to filter (hide/show) items in ListView in Virtual Mode. I have my items cached in an array of listview items, how could I effectively make it so only specific listview items are displayed when pressing a filter-button, and then all of them...