Questions tagged [c#-4.0]

C# 4.0 introduced features like dynamic objects, COM interoperability improvements, generic co- and contra-variance, optional and named parameters. Use this tag if your question specifically pertains to C# 4.0 specific features. The C# tag should be used if your question is not specific to C# 4.0 features.

c#-4.0
Filter by
Sorted by
Tagged with
0 votes
1 answer
1k views

how can I take the value of a NumericUpDown in C# and use it for something ex. use as an int

I'm making a Higher Lower game, and the number of tries the user has to guess the computer's number, I want to set using a NumbericUpDown. How can I do this? (Should I paste my code here so you can ...
wizlog's user avatar
  • 302
1 vote
2 answers
957 views

Transaction for two different entities in Entity Framework 4

I have two different entities of different databases. In my process I want to manipulate both databases, and the whole process must be in transaction. I have tried with TransactionScope. It works fine ...
Naresh Goradara's user avatar
1 vote
1 answer
2k views

RibbonGroup Header on Top

I am trying to figure out how to implement the "Better" example of what is shown here: Specifically what is used for "Indent" and "Spacing" headings. I assume its just a RibbonGroup header with the ...
KrisTrip's user avatar
  • 5,013
3 votes
1 answer
10k views

WPF 4.0 InvokeCommandAction Compatibility (System.Windows.Interactivity)

I have a problem when I insert a InvokeCommandAction (Blend 4 SDK) in WPF 4.0. The usercontrol is not displayed and I've got some exceptions. (log on bottom) Without the line in my xaml code, there is ...
scrat789's user avatar
  • 2,999
1 vote
1 answer
1k views

Replace Assembly.LoadFrom(String, Evidence) call with Assembly.LoadFrom(String) - .NET 4

I have to move some old .NET 2 code to the .NET 4 project. It has the next line: `return Assembly.LoadFrom(filePath, Assembly.GetExecutingAssembly().Evidence);` As it said in Microsoft's (MSDN): ...
Alexander's user avatar
2 votes
2 answers
1k views

How this code works for handling INotifyPropertyChanged

I see below code in this link : An elegant way to implement INotifyPropertyChanged I'm new to Expression Tree.can any one please explane how this code work simply? thanks private string _name; ...
DooDoo's user avatar
  • 13.2k
0 votes
1 answer
494 views

Using Pgp.exe from a MVC application

I've been tasked with converting a legacy application to mvc. The app used pgp.exe to pgp sign user input and send it as an email. The application works locally and on a test server but won't run on ...
Andy Allison's user avatar
0 votes
1 answer
469 views

C# RegEx pattern for scheduler (date / time alike pattern matcher)

Can someone guide me in the direction on how to get a RegEx pattern matching the following possibilities for C#?: RegEx using 4 parameters First 2 params can get the star (*) character as value 1st ...
user706058's user avatar
5 votes
3 answers
10k views

Prevent ToolStripMenuItem context menu from closing on click

I'm trying to have my context menu stay on screen even after I click one of its dropdown items (when the shift key is pressed, though I don't think that matters to the issue). You can see an example ...
Flood's user avatar
  • 345
5 votes
1 answer
198 views

edit context menu in browser

I tried to edit context menu in web browser. I know the way how to edit in windows application but my need is same thing in web browser, means when user right click on web browser the context menu ...
Gaurav Agrawal's user avatar
1 vote
2 answers
617 views

How to convert string into string array

If i have string like that: string s = "xzy..."; how to convert it to array like that: string[] ss = {"x", "z", "y", ...}
Joper's user avatar
  • 8,119
10 votes
3 answers
1k views

How to pass more data then the username/password to the service method in WCF 4.0 RESTful service, using basic authentication

The requirements: WCF 4.0 IIS host Basic authentication with custom source RESTful There are plenty of examples and ways how to implement the basic authentication, from using ...
Sunny Milenov's user avatar
2 votes
4 answers
1k views

c# compare two arrays with conditions

If i have two arrays First: A, B, C Second: ?, B, C I want to compare only items from Second with items from First which is does not contains question mark "?". So for such case: First: A,...
Joper's user avatar
  • 8,119
2 votes
4 answers
5k views

How to clear the default gateway of a network interface (nic) using C#

I'm currently changing the default gateway using: ManagementBaseObject gateway = mo.GetMethodParameters("SetGateways"); gateway["DefaultIPGateway"] = new string[] { "192.168.0.1" }; var r = mo....
Geykel's user avatar
  • 1,908
0 votes
1 answer
772 views

documentation on how to use MSBuild Namespace in C# Source code

I am looking for some simple answers on how to use funktionality from MSBuild in a c# program. The native documentation seems to be completely useless, because I only find information like: ...
traveller's user avatar
  • 189
2 votes
0 answers
258 views

Cannot Perform Linq-To-Sql Stored Procedures with MVC-Mini-Profiler

I am using the MVC-Mini-Profiler in my ASP.net 4.0 C# environment along with MSSQL and Linq-to-SQL. I am having an issue with using L2S with the profiler. Whenever I return new ...
Reaction21's user avatar
1 vote
1 answer
100 views

Impleneting general function for generic interface

EDIT Mistyped property name in example Let's assume we have interfaces like this public interface IBase {} public interface IItf_1: IBase {} public interface IItf_2: IBase {} public interface IItf_3:...
SOReader's user avatar
  • 5,857
0 votes
2 answers
429 views

Entity Framework 4.0 Self Tracking Load Navigation Properties

I have this code for my Data Access class where I want to load all the Patients where they some should have, Patient.Addresses, Patient.Examinations, Examinations.LeftEye, Examinations.RightEye.... ...
xplat's user avatar
  • 8,526
1 vote
3 answers
4k views

Binding a method to a column in datagrid WPF

I have a data grid in wpf which is bound to Collection. In one of the columns i want to bind a public method which returns string instead of a property. Is there a way to resolve this in WPF. By the ...
Novice's user avatar
  • 2,477
0 votes
2 answers
238 views

Convert SQL to LINQ

I'm having a hard time with this SQL Query. I need to convert this to LINQ but n o luck so far. Linqer simply fails. SELECT dbo.County.Name AS County, dbo.JobBooking.OID AS BookingID, ...
DoomerDGR8's user avatar
  • 4,990
3 votes
1 answer
2k views

Silverlight 4.0 Cannot create an instance of "CustomControl"

I'm currently working on a small project, and I am having some trouble with silverlight custom controls. I am trying to create a custom ScrollViewer (that will contain small images) for photo gallery. ...
Denis Rosca's user avatar
  • 3,459
3 votes
3 answers
5k views

RegEx help to remove noise words or stop words from string

I want to remove all noise tags from input tags (a string) The tags are separated by comma. If a noise word is part of a big tag, it will remain. This is what I have but not working: string ...
kheya's user avatar
  • 7,616
1 vote
1 answer
2k views

Where can i find microsoft.office.infopath.dll in Windows 7

I installed Microsoft office professional 2003 package, which also includes Microsoft office infopath, but microsoft.office.infopath.dll is missing in .Net Framework Components and in GAC. Please give ...
kalai's user avatar
  • 83
3 votes
1 answer
3k views

OrderByDescending on list of DateTime's not working?

In a lambda expression, how do you order by a list of DateTime values, rather than an object? For example, I want to get the most recent 3 pay dates on the following query: var hires = (from e in ...
Beep beep's user avatar
  • 19k
2 votes
1 answer
82 views

How to determine one method "Is extension method of a Type or not?"

I want to write a method named IsExtensionMethod that its signature is : public bool IsExtensionMethod(object anObject, string method) { // if method was an extension for anObject return true ...
Saeed Afshari's user avatar
2 votes
2 answers
3k views

How to call a procedure after finish the Task

How I can aware of a Task finished ?I want a thing like RunWorkerCompleted event in BackGroundWorker. thanks
DooDoo's user avatar
  • 13.2k
3 votes
1 answer
1k views

What type of data must be converted when passed between .NET and COM-based components?

What is the correct answer to the following question: What type of data must be converted when passed between .NET and COM-based components? A class object containing only simple value types COM-...
sapna's user avatar
  • 31
1 vote
2 answers
142 views

Linq conflict error

I keep getting these on my website, visitors reporting them fairly regularly as well. Refreshing the page always fixes it. Here is an email report I got from the server for a typical one: Error ...
Tom Gullen's user avatar
2 votes
4 answers
6k views

C# WCF Web API + JSONP

Is there an easy way to get JSONP working for the new WCF Web API rest services? I've tried this with no luck <standardEndpoints> <webHttpEndpoint> <standardEndpoint name="" ...
Chris Kolenko's user avatar
6 votes
2 answers
5k views

Chained GZipStream/DeflateStream and CryptoStream (AES) breaks when reading

I want to compress and then encrypt my data, and for improved speed (by not having to write to byte arrays and back) decided to chain the streams used for compression and encryption together. It ...
cervellous's user avatar
4 votes
4 answers
20k views

C# get or set cookies, to download content from the web using cookies

I need help with cookies. I'm planing use cookies to download web content. To get the content I need to log into a website because only authorized users can download web content or files. I'm using ...
qdza's user avatar
  • 41
1 vote
2 answers
1k views

Check CPU Usage and log Processes that have up to 30% CPU Usage in Windows

I have 3 relational question: I want to check cpu usage and write this code: public partial class MainWindow : Window { private DataTable tbl; private int ID; private DispatcherTimer ...
DooDoo's user avatar
  • 13.2k
0 votes
1 answer
152 views

JavaScriptSerializer Question

I am having some issues DeSerializing the following Json, it runs, throws no errors however the props in the class are all null so it is obviously not working. { "realms":[ { "type":"pve", "queue":...
Code Jammr's user avatar
  • 1,867
1 vote
2 answers
636 views

Type parameters - get concrete type from type T : IMyInterface

Suppose I have a List<IMyInterface>... I have three classes which implement IMyInterface: MyClass1, MyClass2, and MyClass3 I have a readonly Dictionary: private static readonly Dictionary<...
Conrad Clark's user avatar
  • 4,543
0 votes
1 answer
979 views

How to implement PetaPoco with existing C# 3-tier win app

can anyone help me with converting my project to use PetaPoco? here is my issue. backend is SQL 2010 database .NET fraimework 4.0 I have an existing 3-tier win app in C# that uses a custom DAL -- ...
Vlad's user avatar
  • 11
1 vote
0 answers
174 views

continuous integration tools for visual studio [duplicate]

Possible Duplicate: Best Continuous Integration Setup for a solo developer (.NET) I want to use a continuous integration (CI) software to improve the quality of my work. Based on your ...
soumial's user avatar
  • 73
0 votes
1 answer
268 views

Utility to generate DataLayer

I need to write a Utility, which will capable to generate Data Layer from any following Databases : Mssql MySQL Oracle For example : I have SQL Database which contains several Tables, Views, ...
Gaurav Arora's user avatar
  • 2,293
1 vote
1 answer
930 views

EF Linq Query Collection with an eager loaded child-collection

I'm using EF4.1 code first, I'm trying to to create a query which returns a collection with an eager loaded child-collection. Both has to be ordered by Position and IsActive == true These Classes ...
jani's user avatar
  • 1,354
0 votes
1 answer
4k views

How to validate an XML with an XSD using LINQ

EDIT2: the problem seems to be my xsd. it validates pretty much every XML. i can't post the XSD on here though. why would every XML be valid for an XSD? EDIT: found a similar excample in the answer ...
Andy's user avatar
  • 2,318
1 vote
3 answers
3k views

How to read web.config's value in ascx page

I want to access the web.config's value in ascx page(design page) and have to assign these values to a drop down list.how to do that?any help
shafi's user avatar
  • 11
0 votes
1 answer
1k views

Shortening url using bit.ly

I am creating short urls as we have done with tiny URL, based on the link: http://www.emadibrahim.com/2009/05/07/shortening-urls-with-bitlys-api-in-net/ But I am getting an error: The remote ...
Kuttan Sujith's user avatar
0 votes
2 answers
2k views

How to set height auto CSS property?

This is a CSS question in asp.net. I have a page which is surrounded by container div. This contains div#contenthome, with div#flashhome inside it. #Container and #contenthome height property is ...
Hemant Kumar's user avatar
  • 4,603
1 vote
0 answers
271 views

Workflow 4, Why WaitForInput can not accept Input=[command]

I'm trying to implement a multi steps wizard using WF4 for my MVC project. I've installed "Client Profile Platform Update 1" on my machine and I've implemented my project based on this sample : http:/...
Amir978's user avatar
  • 903
1 vote
2 answers
2k views

Copy data from List<MyEntity> to DataTable object

I have a a List<> of objects (where the objects are a custom entity class) and I have a DataTable which has columns that match the Properties of the Entity class. Is there a way I can copy the ...
Jed's user avatar
  • 10.8k
2 votes
2 answers
1k views

Retrieving HTML from ASP.NET page on postback

I've found a few posts about retrieving HTML from an ASPX page, mostly by overriding the render method, using a WebClient, or creating an HttpWebRequest. All these methods return the HTML of the page ...
Sivvy's user avatar
  • 851
0 votes
2 answers
189 views

Syncing program clock with website clock

Got a question on how i can create a clock for a program i am writing and then sync it to the clock on this website: Grand Prix Racing Online Will be working on .net 4.0 and C#. I know the basics ...
Shoaib Mohamed's user avatar
1 vote
2 answers
705 views

DisplayFormat unit testing with HtmlHelper

MyModel _model = new MyModel() { PriceDate = new DateTime(2000, 1, 1)}; var helper = new System.Web.Mvc.HtmlHelper<MyModel>(new ViewContext(), new ViewPage()); var result = helper.DisplayFor(m =...
gingerbreadboy's user avatar
3 votes
4 answers
5k views

Calculate execution time of one or more lines of code

Is there a way (a class-made in C #) that would allow me to calculate the time required to execute some lines in my program. Ex : try { string connectionString = GetConnectionString(); using (...
soumial's user avatar
  • 73
0 votes
1 answer
215 views

After first click_event was fired, the second click_event does not fire

I have two linkbuttons which are added dynamically depending on conditions, whether to display one or another. These buttons have events also. Firstly displayed button's event fires, but when ...
Mailis Toompuu's user avatar
0 votes
1 answer
1k views

MPXJ consistently adds blank task name...is MPXJ better than Interop?

I'm trying to use MPXJ to create project file from a hierarchy that exists in my code. The following hierarchy needs to be converted: Division Customer Contract Projects Project details (start/...
Thelonias's user avatar
  • 2,927

1
453 454
455
456 457
517