C# is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines.

learn more… | top users | synonyms (4) | c# jobs

0
votes
1answer
11 views

How to encode html data in asp / vb.net boundcolumn datagrid?

I have some data in database which I am binding it to a bound column. Data contains many html tags. But I want to display it as TEXT only "NOT TO RENDER IT" I am not sure because HTMLENCODE property ...
0
votes
3answers
65 views

C# Equivalent to Java's Double Brace Initialization?

Expected code in C# (that Java has) List<String> myList = new List<String>() {{ add("Hello"); add("World!"); }} // myList = [ "Hello", "World" ] Just wondering if there is an ...
0
votes
1answer
39 views

I am learning C# I want to put in a int but cant figure how to convert it

I want the user to be able to enter the number at the menu however when I do this it says its a string being enter. I have tried to convert as I left the code in but it will not work. namespace ...
0
votes
0answers
7 views

Reflect changes Dynamically in javascript guage in c#

I have a Web form. Based on its user input. A Score is calculated. I want to reflect/represent that value of score on a guage. My problem is, the Variable which contains the value of score is ...
0
votes
4answers
29 views

Get fields from anonymous type

I have this class: public class allFields { public string EAN { get; set; } public string title { get; set; } public string qty { get; set; } public string price { get; set; } ...
0
votes
0answers
9 views

C# Thread won't die properly unless I step through the code

My thread (_updater) is started by this: public void StartCollection() { running = true; _updater = new Thread(new ThreadStart(ContinuousCollect)); _updater.Start(); ...
0
votes
0answers
25 views

Linq Grouping the result of group by query

I have the following exemple : Model mod1 = new Model { Header = "A", canDelete = true,pax=1 }; Model mod2 = new Model { Header = "B", canDelete = true,pax=1 }; Model mod3 = new Model { Header = ...
-1
votes
1answer
23 views

Nancy Self Host and Static Content Files

Am I right in thinking that if you create a self host nancy console app and want to serve up html,javascript and css files that you have to go thru all these files (could be quite a few) and mark ...
0
votes
0answers
7 views

Get Updated Row Count in Transaction Scope

I am doing some insertion operation in SQL server within TransactionScope. Here is my code using (var scope = new TransactionScope(TransactionScopeOption.Required)) { Int32 existingDBRowCount = ...
0
votes
1answer
54 views

Pass a parameter that has more than 4000 characters

I have a SQL Server stored procedure that is something like this, it will get ProjectList(string contains 22000 characters) and CultureList from c#, split two strings in a function called fn_split, ...
0
votes
2answers
25 views

Running without launching browser window

I've literally just started looking into Selenium today, so please bear with me if I've missed something obvious. I'm attempting to build a small windows service that can monitor a few websites to ...
0
votes
2answers
18 views

System.ArgumentException occurred

I'm getting a strange behavior. This is the code: ... private Object lockobj = new Object(); private Dictionary<String, BasicTagBean> toVerifyTags = null; public void ...
0
votes
1answer
24 views

System.OutOfMemoryException - when Entity Framework is querying a too big data of Varbinary type

I'm trying to query a varbinary column that contain a file (1,2 Gb). I'm using Entity Framework. See below: Database to test CREATE TABLE [dbo].[BIGDATA] ( [id] [bigint] IDENTITY(1,1) NOT NULL, ...
-2
votes
0answers
34 views

Called .exe file in C# is not shown in list of processes

I wrote a code with c# to call and run an .exe file: string targetDir = string.Format(@"C:\MYP\myexe"); proc = new Process(); proc.StartInfo.WorkingDirectory = targetDir; proc.StartInfo.FileName = ...
0
votes
3answers
28 views

JavaScriptSerializer is not deserializing System.Drawing.Color. How to deserialize Color object?

I have serialized System.Drawing.Color in JSON using JavaScriptSerializer, but when i try to de-serialize it, it returns Color object with All the values 0. Sample JSON is as below. { "A":255, ...
0
votes
0answers
8 views

windows phone 8.1 shift key state abnormal behaviour?

im develeoping windows phone 8.1 app. In a textbox I want to prevent the user from inputting any non-digital letter only [0-9]. So here is my code: private void NumKeyDown(object sender, ...
-1
votes
3answers
3k views

C# ErrorProvider Want to know if any are Active

I want to know if any ErrorProvider are active in my form. being able to find this out might help reduce my code.. I did find this thing here Counting ErrorProvider but incase someone knows a better ...
0
votes
3answers
38 views

C# change multiple labels by looping

To prevent code duplication, I`m looking for a solution for this below: private void sensor1SetUnits(string newUnit) { foreach (Control ctrl in groupBoxSensor1.Controls) { ...
0
votes
4answers
26 views

Not sure if i'm getting the Description attribute correctly

I have a separate class that I would like to get the "Description" attribute: public class Fruits { [Description("The green apples are very green.")] public const string Apples= "Green"; ...
0
votes
0answers
18 views

Calling an Oracle insert stored procedure from C#

Stored procedure: CREATE OR REPLACE PROCEDURE insertMovie( p_m_id IN MOVIE.M_ID%TYPE, p_movie_name IN MOVIE.MOVIE_NAME%TYPE, p_year IN MOVIE.YEAR%TYPE, p_category IN MOVIE.CATEGORY%TYPE) ...
2
votes
1answer
31 views

Multiple constraint on type parameter

I did this multiple constraint public class BaseValidation<S, R> where R : BaseRepository where S : BaseService<R>, new() { public S service; public ...
0
votes
2answers
43 views

C# When Assemblies are referenced in the Web.config, where does it look?

I have an assembly that apparently has server credentials hard coded into the DLL. Those credentials have since changed. My assemblies are listed as: <assemblies> <add ...
0
votes
0answers
15 views

How can I debug ASP.net unit tests?

I'm trying to unit test some special header handling on an MVC website, but I can't for the life of me get it to even consider starting up the development web server to debug the unit tests. All the ...
0
votes
1answer
21 views

RestSharp JSON Not Deseralizing

I have a RESTful WCF Service function, however it is not serializing properly via the RestSharp Client. [ServiceContract] public interface IRestDragon { [OperationContract(Name = "getconfig")] ...
1
vote
2answers
51 views

How to extracting method's parameter names, and use them as a Dictionary keys?

Imagine there is a simple method like this: public async Task<ValidatePhoneNumberResult> ValidatePhoneNumberAsync( string phone_number, string country_code, string country_iso, ...
-3
votes
1answer
50 views

The code of: Click a button, in Visual Studio with C# and Selenium

I wonder how to create the Selenium C# code line in Visual Studio to click in a button with driver.FindElement(By.xxx("(//xxx'])[xxx]")).Click(); Html button code <button ...
2
votes
0answers
9 views

How can I dynamically update bindings in MvvmCross?

I know that bindings in MvvmCross get hooked up initially when we call SetContentView. However, I am dynamically creating a new view and the bindings from it are not being hooked up. Is there a way to ...
0
votes
0answers
5 views

Salesforce returns Unknown Error while trying to insert using REST API

My project is interacting with SalesForce and I am able to retrieve data from salesforce.But when I tried to POST JSON back to Salesforce for creating new record, I am getting a response as "UNKNOWN ...
1
vote
0answers
11 views

Can't see the cursor's movement programmatically

OK there, after really doing some research and trying a lot of examples- Moving mouse cursor programmatically How to move mouse cursor using c#? Getting mouse position in c# Control the mouse ...
0
votes
0answers
16 views

Invalid JSON primitive: . Trying to deserialize from JSON in C#

I need to deserialize some data serverside from a third party (It is done serverside for accessibility reasons, not by choice). However, I get I am calling the following line of code: var data = ...
0
votes
1answer
13 views

Remove elements from a splitted string before populating a listbox

private void sendBCode() { NetworkStream serverStream = clientSocket.GetStream(); outStream = Encoding.ASCII.GetBytes("0000|ORD|SUPP"); serverStream.Write(outStream, 0, ...
0
votes
1answer
23 views

Is it ok to have a static property into a repository or it's a bad practice?

I'm building a winform using MVP in C# and I have a repository which retrieves all the data from the DB but to retrieve that data I'm not using an ID, instead it's a reference(string) inserted by the ...
0
votes
2answers
46 views

Why doesn't UriBuilder.query escaping (url encoding) the query string?

The UriBuilder.Query property "contains any query information included in the URI." According to the docs, "the query information is escaped according to RFC 2396." Based on this, and since this ...
0
votes
0answers
11 views

C# Moq Entity Framework 6 Data Context Add Operation

I want to test that a method adds a record to a DBSet under a certain condition: public static void AddTriggeredInternalTransactions(IDataContext dc, ExternalTransaction transaction) { if ...
0
votes
0answers
6 views

Windows portable device for camera c#

everyone. I'm on a quest to create a win form application which can acquire data from images using web camera,turning image into some useful information, so that i can manipulate those data acquired ...
0
votes
1answer
43 views

Should there be any need to type 'static' before each member in a static class?

Since a static class can contain only static members, should there be any need to type static before each member? What I really want to know is that: can a static class contain anything other than ...
1
vote
1answer
765 views

Converting Multiple Images into Multiple Pages PDF using itextsharp

I have requirement to convert images into PDF with a template. I'm able to create one page PDF using itextsharp. Assumption 1 image for 1 page PDF. The problem comes when I have multiple images. How I ...
0
votes
0answers
7 views

How to change the scope of an existing binding in Ninject

In one module, I have a binding set up for an object. There are two other modules: a testing module and a web module. The web module wants that binding to be in request scope, and the testing module ...
2
votes
3answers
66 views

Does a name exist for the parenthesis after new()?

I wanted to inquire more about a construct I occasionally see in some C# code; however, I don't know the name. I apologize if this is a duplicate; however, its very hard to search for things without ...
1
vote
2answers
28 views

Why am i getting 'No Overload Method .createBanner takes '3' arguments?

Why am I getting the error No Overload Method .createBanner takes '3' arguments when I try to call CreateBanner using Google Admob? using UnityEngine; using System.Collections; public class AdMob : ...
0
votes
1answer
23 views

jTable in ASP.Net Eror in communicating with server

I've been trying to get my jtable to work from aspx c# codes.. ASP.net i suppose. But after messing it with days... I'm still unable to figure out where did i make a mistake that gives me this error, ...
1
vote
3answers
1k views

Simple implementation for detecting cycles in a directed graph in C#

I wonder if you could help me with a simple implementation for detecting cycles in a directed graph in C#. I've read about the algorithms but I'd like to find something already implemented, very ...
0
votes
0answers
9 views

Smartcard reader naming

I have two readers (HID OMNIKEY 5321) in system (every reader performs a different function) reader 1 - "Smart Card Reader 0" reader 2 - "Smart Card Reader 1" In my program is set up that ...
0
votes
0answers
12 views

LINQ to SQL. ChangeConflictException: MemberConflicts.Count = 0

I'm using LINQ to SQL on data layer of my application. I've got strange "type" of error on submit changes. Here is a part of my code: try { ...
1
vote
3answers
30 views

Adding info to a xml file

I have a XML file which contains about 850 XML nodes. Like this: <NameValueItem> <Text>Test</Text> <Code>Test</Code> </NameValueItem> ........ 849 more ...
0
votes
1answer
13 views

Validation on a button click using RequiredFieldValidator

In the past, on button click events, I've validated without using RequiredFieldValidators. However, I thought I'd learn about them and implement them. My old approach: protected void ...
0
votes
0answers
23 views

Can't connect to excel file unless file is already open

I'm trying to write a class that will read information from an excel file, but for some reason, it will only run exception-free if the file in question is open in excel. Otherwise, the class throws ...
0
votes
1answer
25 views

Some elements of control not recognized by C# compiler

I have a site that is using the aspdotnetstorefront platform, although this should pertain to any C# site. There is a custom control in a dll named Account. This has several elements including text ...
0
votes
0answers
7 views

RadScriptManager and link button

<telerik:RadScriptManager ID="RadScriptManager1" runat="server" OnNavigate="OnNavigateHistory" EnableHistory="true" EnableSecureHistoryState="false" AsyncPostBackTimeout="600"/> ...
0
votes
1answer
14 views

Very poor performance by Nhibernate & Unitwork pattern

I have one complex object like this A | | | |->C(As child)---->it has 4 hastomany properties(each B has 10000 C child) B(has many child)-> |->D(As ...