.net

How can tell if my object's value is a float or int?

How can tell if my object's value is a float or int? For example, I would like this to return me bool value. ...

How to hide a tab (not just disable it) in .NET CF

When a particular tab on a TabControl is selected, I currently disable all other tabs using TabControl.Enabled = false. I would also like to hide them to avoid confusing users. Is there any way of doing this without removing the tabs and then adding them back in? ...

Is the Linq Count() faster or slower than List.Count or Array.Length?

Is the Linq Count() method any faster or slower than List<>.Count or Array.Length? ...

How to post a file via HTTP post in vb.net

Hi all! Having a problem with sending a file via HTTP post in vb.net. I am trying to mimic the following HTML so the vb.net does the same thing. <form enctype="multipart/form-data" method="post" action="/cgi-bin/upload.cgi"> File to Upload: <input type="file" name="filename"/> <input type="submit" value="Upload" name="Submit"/> </form...

.net Compact Edition 2.0, SQL Server Compact Edition and replication

Hi Guys, I have been tasked with creating a mobile application for a Windows 6.0 CE device which is running .NET 2.0.7045.0 Compact Framework. I have SQL Server 2005 Express running on my local machine and I want to let the Mobile Application have a replication or snapshot of my database, so the users can update the data in the field. ...

Why can't I force SSL for Sql Server Reporting Services?

I am trying to setup SSRS 2008 on Windows Server 2008. It seems to work as expected when I access the web interface through HTTP, but when using HTTPS the following error is what I get: "The underlying connection was closed: An unexpected error occurred on a send." From a look at the log files, it is revealed that the inner exception is...

Return single column with Linq

public string GetNameBySSN(string SSN) { var results = from c in Clients where c.ClientSSN.Equals(IRRCNumber) select c.FirstName; //return results.ToString(); } I want to return a single column value with Linq and not sure if there is way to do a quick easy return. I commented section of c...

Is it possible to register a .net assembly as COM without strong naming it?

Ok, so i know how to strong name an assembly and regasm it, so I can access it from a an ASP page. By strong naming it, it can be placed in the GAC and thus be easily accessible from an ASP page. Is it possible to somehow register the assembly without signing it with a strong name and still be able, somehow to access it from the ASP pa...

What is the best way to implement versioning of a binary?

I am thinking of the following design: static class AppVersion { public static string BuildDate { get; set; } public static string Version { get; set; } public static string GetVersion { get; set; } } A few questions on this: How can I get the build date? How can I...

Read from console process

I have a process, i can start, and hide working fine, but i want to read from the console program, when i runs, not after, i tried to run a timer, anbd read at the tick, but my program just crashes and when it not do, i get nothing at all. startInfo= new ProcessStartInfo("cmd.exe"); startInfo.Arguments ="/C uus.exe "+ arg.ToString...

Moving objects across AppDomains in .NET

Is there a way to efficiently share or move .NET objects across AppDomains? I realize that the intent of AppDomains is to provide isolation - however I have a case where I need to move a relatively large, cached set of immutable objects that are expensive to compute and create. At the moment, I have a serialization approach that works, b...

Reflectively Executing Code in .Net

How do you reflectively, or dynamically, execute code in .Net? If an XML contains something inside '[]' I want to handle the text not as text but as code: <Name>DateZero</Name> <Value>DateTime.Now.AddDays(-2)</Value> <Name>DateOne</Name> <Value>[DateTime.Now.AddDays(-1).ToString("MM/dd/yy")]</Value> <Name>DateTwo</Name> <Value>[DateT...

.NET / C# - Convert List to a SortedList

What is the best way to convert a List to SortedList? Any good way to do it without cycling through it? Any clever way to do it with an OrderBy()? WRAP UP Please read all answers and comments. ...

Would MEF work for a product?

We have developed a product (Core). We extend and override functioanlity in Core to create bespoke applications (Product). Product has a reference to Core so it can inherit from the base forms and override the functionality. Would MEF be n advantage here or is it more for plug-ins? Thanks, B ...

Set similar object properties in another object.

I have two objects that contain some properties that are exactly the same (same name, type). What I want to do is populate one object's identical properties with another object's properties. I am trying to do this in code, but it's not working. The Bin object's properties are not being set. class Basket{ public Basket(int itemId, in...

Convert .Net Color Objects to HEX codes and Back

As per the question title, How could I take a hex code and convert it to a .Net Color object, and do it the other way? I googled and keep getting the same way which doesn't work. ColorTranslator.ToHtml(renderedChart.ForeColor) Which returns the name of the color as in 'White' instead of '#ffffff'! Doing it the other way seems to ha...

Activator.CreateInstance(t, 42, args) cannot find constructor

I am using (a slightly extended version of) the following code in a factory-pattern style function: public class SingleItemNew : CheckoutContext { public BookingContext Data { get; set; } public SingleItemNew(BookingContext data) { Data = data; } } public CheckoutContext findContext(BookingContext...

.NET Max Memory Use 2GB even for x64 Assemblies

I've read (http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx) that the maximum size of an object in .NET is 2 GB. Am I correct in assuming that if I have an Object that takes up 256 MB Memory, since it is a reference type, I can have an array of these 256 MB Objects where all the objects together may takeup >2GB Memory as lon...

How can I get the assembly version as a integer in C#?

I can get it as a string: Assembly.GetExecutingAssembly().GetName().Version() How can I convert this number to an int? Example input: 8.0.0.1 Expected output: 8001 ...

How to get Elmah working with ASP.NET and IIS 5.1 URL Routing

I am having issues with regards to running my ASP.NET MVC application thru my local IIS 5.1 web server. I believe these issues are related to IgnoreRoutes, but I can't seem to craft an IgnoreRoute such that it resolves the problem. Problem: I am able to view my elmah error page (localhost/mvcapplication1/elmah.axd), however, the CSS i...