.net

Linq to Entity get a Date from DateTime

var islemList = (from isl in entities.Islemler where (isl.KayitTarihi.Date >= dbas && isl.KayitTarihi.Value.Date <= dbit) select isl); It gives error: date is not supported in LINQ to Entities... How can i get date in linq. ...

Could not load type xxx from assembly xxx

Hi I'm making a windows application where user selects a type from combo box. Based on the selection, using reflection I want to create instance of the respective type and invoke one of its method. The Types I want to create are also defined in the same windows app as sperate classes. But i'm getting the error as mentioned in Title. He...

[entity framework] multiple edmx in the same .net solution

hi I have 2 project in my .net solution.each one has entity data model.how I can make an association between two entities one in the first project data model while the other in the second project data model in the same solution? what if each data model mapped to different database? ...

KeyPreview (KeyUp) handler passing KeyUp to forms created in the method

Issue Weird problem. We've got two forms: the main application window and a settings form. The main form has its KeyPreview set to true, and a method attached to its KeyUp event. This is so that the settings window can be opened with a key shortcut (ctrl-m): private void MyShortcuts(object sender, KeyEventArgs e) { if (e.Control &&...

.NET assembly not creating as backgrouond process using System.Process

Hello, I am trying to launch background processes using System.Diagnostic.Process API . It launches every process e.g notepad.exe, all native processes and all windows form base processes. But this unable to launch pure managed GUI less assemblies. Task Manager not showing those assemblies listed in its list as seperate process. Niether...

System.InvalidOperationException in vs 2005

Hi all, I used dotnetmagic library and created a dockable window, that when run from IDE (VS2005) works, but when I use the executable it raises an exception which reads: System.InvalidOperationException: DragDrop registration did not succeed. ---> System.Threading.ThreadStateException: Current thread must be set to single thread ...

Xml to Json Conversion using Newtonsoft Json.Net: Removing @ prefix?

I am using Newtonsoft Json.Net to convert Xml to Json. Following Xml <root> <person id="1"> <name type="first">Alan</name> <url>http://www.google.com&lt;/url&gt; </person> <person id="2"> <name type="last">Louis</name> <url>http://www.yahoo.com&lt;/url&gt; </person> </root> Is converted to following Json. { "root":...

Dynamically evaluating string conditions in C#

I have a collection of strings. I need to find out from this collection strings which satisfies some condition e.g. that string contains A and B or C. These criteria are specified by the user so they are dynamic. In Linq it should be something like, List<String> items = new List<string> { "sdsdsd", "sdsd", "abc"}; var query = from item...

How can I detect if my .NET assembly is running from web site or from a desktop machine?

I just want to write code inside my assembly to detect whether it is running on a "desktop machine", or inside the context of an ASP.NET application. This is crucial guys, (licensing purposes), and I don't want to get fired because I did a mistake. So, please, be direct and if you please give me some code snippet. EDIT: I depend on you...

C# - Which is faster: String.Contains() or Regex.isMatch()?

Possible Duplicate: Regex.IsMatch vs string.Contains Which is faster, preferable and why? What the difference in mechanisms between two? I need to search for some values from UserAgent, most of values can be used without wildcards (e.g. if I want to catch cellular phones I search for iPhone instead of *iPhone* wildcards). ...

SerialPort port.open "The port 'COM2' does not exist."

Hi, I'm having a big problem with the SerialPort.Open(); I am communicating with an usb virtual com port (cdc), and it is listed as COM2. It works fine in TeraTerm/hyperTerminal ect. but when I try to open the port in C#, it gives me the Exception "The port 'COM2' does not exist". I get the port name using the SerialPort.GetPortNames...

Is there a SL4J logging library for .net?

In java, there is a library called SL4J that "wraps" several different logging implementations (default jdk, log4j, commons logging etc.) and makes it quite easy to replace the logging implementation without any code changes. Is there such a library for .net? ...

Why is ComputeHash not acting deterministicly?

I've run into an interesting issue.. It seems that ComputeHash() for a "HMACSHA256" hash is not behaving deterministicly.. if I create two instances of HashAlgorithm using HashAlgorithm.Create("HMACSHA256").. And run ComputeHash, I get two different results.. below is an example static class that exhibiting this behavior. internal s...

List of silverlight limitations / restrictions

I have seen and heard of various Silverlight restrictions, e.g. file I/O restrictions, some reflection limitations, restrictions on which languages can be used, printing, resolution, etc. Could you please compile a list of all major silverlight limitations, as compared to a full-blown .NET application? This is for the latest version (4....

Set all values of IDictionary

What is the best way to "reset" a Dictionary<int, bool> type of structure (set all values to true or false). Currently I'm using a ToDictionary() extension method. Is there a way to do this by reusing the current instance? This code throws an exception: [TestFixture] public class Sample { [Test] public void SampleTest() { ...

Deplhi to .Net format string conversion

I am looking for a library or snippet to convert Date/Time format strings from Delphi to .Net. This is for Delphi version 2007. For example, Delphi 2007 specifies "m" as month, whereas .Net uses "M". However, in Delphi, if the "m" follows an "h", then it represents a minute value. Are any available, or do I have to roll my own? ...

Control concurrency in multiple users web application gridview

Guys i'm with a big problem. I'm running a backoffice application, and imagine, i have a form than contains a gridview editable. 100 Users go to the page 100 Users view the form page as the data provided from database 100 Users edit some fields How control the final data and consistency in this example? ...

Programming certification and exams which can be taken online

I'm interested in a list of publicly available programming exams which can be taken online. E.g. Brainbench offers a broad range of tests and certifications (including .NET technologies). ExpertRating is an option as well. Any similar services? I'm also interested knowing if there are any Microsoft exams available online. Thanks guys f...

Problem reading large dot delimited strings from excel sheet column into dataset.

hi everyone, I am trying to read the content of an excel sheet using the following code. string tempExcelFileUploadPath="C:\\Documents and Settings\\......\\excelsheet.xls"; String excelConnectionString1; //connection string for excel sheet excelConnectionString1 = @"Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data ...

Homework: Negative to -1, 0 to 0, Positive to 1

I have an enumeration MyEnum (Neg -1; None 0; Pos 1). I use the result of CompareTo() to initialize a object of that enum. What is the most performant way in .NET to do it (Negative to -1, 0 to 0, Positive to 1)? NB. CompareTo() returns an Integer value.. ...