.net-3.5

Basic question about OOP Class Structure with LINQ

I have this situation: public class busOrder: IbusOrder { public Order vOrder { get; set; } MyDataContext db = new MyDataContext(); public busOrder(int pOrderId) { vOrder = db.Orders.SingleOrDefault(p => p.Id == pOrderId); } public int SaveNew() { ... } public int GetStatus() {...

How to force an application to use .NET 3.5 or above?

Our application is built with VS 2008, uses Linq and has Target Framework set to .NET Framework3.5. It works OK when only .NET 3.5 or 4 is installed on the machine. However, on machines where both .NET 2 (or 3.0) and .NET 4 are installed, the application is loaded with .NET 2, and crashes when Linq is accessed, as it looks for the .NET...

WPF: How to set offset to PolyLine

I have 3 PolyLines that have same geometry. I would like to set offset to two of them, so they would appear right next to each other. How can i do that? thanx. ...

How many specified chars are in a string ?

taken a string example as 550e8400-e29b-41d4-a716-446655440000 how can one count how many - chars are in such string? I'm currently using: int total = "550e8400-e29b-41d4-a716-446655440000".Split('-').Length + 1; Is there any method that we don't need to add 1... like using the Count maybe? All other methods such as Contains IndexO...

How to safely split strings?

When we want to split a sting for any kind of reasons, we (at least myself) tend to split using the (pipe) | character as it is very rare to find out someone or that the application uses it on a string ... but what happens if it uses? Well, a simple Crash will be thrown :) I found out that a college uses non-printable chars to do the s...

DateTime issue - value available outside object but not inside

This is a very frustrating and bizarre issue and I would appreciate any advice on how to resolve it. I have an object with a private variable: private DateTime _maturityDate = DateTime.MaxValue; It has a corresponding property: public DateTime MaturityDate { get; set; } I have a method which updates the data in the database calle...

Well-Known Metadata + Wildcards in MSBuild 3.5

Hi guys, I'm currently trying to use MSBuild to set up a project, and am having some issues with wildcards. I'm trying to use the following snippet: <Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt; <ItemGroup> <Xsd Include="App_Data\*.xsd"> <Generator>MSDataSetGenerator</Generator...

Compile assemblies with restrictive access

Is it possible to compile an assembly to either: only include certain code parts OR Allow access to certain code based on a credential? I have an assembly that is redistributed. Certain applications will only use/have access to certain functionality and other will need more. ...

Questions about StructureMap in a (layered) library regarding extendability and testability

Hi, We are using StructureMap as our Dependency Injection (DI) framework while we are creating a layered library. Our goals are to: Make it easy for us to Unit Test classes (and using mock classes instead of the real dependencies) while we develop and maintain the library. Make it easy for the library user to: Customize the library b...

Source property on ResourceDictionary gets assigned late under .NET 4 vs. .NET 3.5

I have an application that loads a series of resource dictionaries programmatically at startup. I have derived AdvancedResourceDictionary from ResourceDictionary and I set its Source property to a XAML file containing an AdvancedResourceDictionary object, like so: var ard = new AdvancedResourceDictionary(); ard.Source = new Uri("/Sandb...

how retrieve the value from more than one list at a time using linQ?

i have two list , List A,List B both have same no of values.i like to pass these values as arguments and selecting returning value .here code for(int i=0;i<A.count;i++) { list<int> temp=new list<int>(); temp.add(methodA(A[i],B[i]); } how can i do this using linq.Is it possible to do in .net 3.5 ...

cannot be open database on server explorer in VS 2008

Hi, am getting following error while opening database on server explorer in VS2008. Unable to open the physical file "D:\MyLab\Exercises\LINQ\TaskList\App_Data\TodoList.mdf". Operating system error 5: "5(Access is denied.)". An attempt to attach an auto-named database for file D:\MyLab\Exercises\LINQ\TaskList\App_Data\TodoList.mdf fail...

open a PDF : WPF

I want to open a PDF file in a button click. I'll keep the PDF file within the solution/namespace of the project. Can anyone give me solution for this? ...

How to return an anonymoust type list

Hi all, it's possible to return, from a method, an anonymous type list? I build my list of anonymoust type like this var l = (new[] { new { Name = "thename", Age = 30 } }).ToList(); Thanks ...

Designing a system with a presentation layer and a web service-based API

Hello, We are designing a system that has functionality that is essentially the same at the presentation layer and the exposed API layer. My question is what technique / strategy to use so we can get the most reuse out of our code with performance in mind? Here's a simplified example: A user can add a Customer via a web form. This wil...

How to compare to "Could not evaluate expression"?

I have a dictionary that is like this: Dictionary<string, object> myDictionary = new Dictionary<string, object>(); When I get data out of it, I am doing it like this: myDictionary["IndexingValue"] Most of the time that is working. But I just changed one of the values that it stores to be null. Now when I do that same call (expect...

C# String manipulation

Hi there. I am working on an application that gets text from a text file on a page. Example link: http://test.com/textfile.txt This text file contains the following text: 1 Milk Stuff1.rar 2 Milk Stuff2.rar 3 Milk Stuff2-1.rar 4 Union Stuff3.rar What I am trying to do is as follows, to remove everything from each line, except for "w...

exception while accessin dll's

Here is the Code i have in my application : try { Assembly assemblyInstance = Assembly.LoadFrom(@"C:\Data\Dlls\Myfunctions.dll") ; } } catch (Exception ex) { MessageBox.Show(ex.Message); } when i'm trying to load the dll i'm getting an exception ----- Could not load file or assembly ' C:\Data\Dlls\Myfunctions.dll' or one of its depen...

Binding to several Prperties

How do bind to more than one property in WPF? I know that you can use the ItemStringFormat="{0} my hard coded string" to describe a string value but I am interested in something like this ItemStringFormat="{0} ({1})" where item zero is a property and item one is a property in the bound class. public class ExchangeRate { public int I...

Retrieving data from API and display it.

I have a link which is returning data in xml. I don't know how may i fetch data from api and display it. I want to fetch data from provided link like http://api.testdata.co.in/a/pn-1?koid=1234&amp;dfr=12.14.127.10 . Any help ? ...