¡@

Home 

c# Programming Glossary: add

Get property value from string using reflection in C#

http://stackoverflow.com/questions/1196991/get-property-value-from-string-using-reflection-in-c-sharp

propName .GetValue src null Of course you will want to add validation and whatnot but that is the gist of it. share improve..

Create Excel (.XLS and .XLSX) file from C# [closed]

http://stackoverflow.com/questions/151005/create-excel-xls-and-xlsx-file-from-c-sharp

C# Ideally I would like open source so I don't have to add any third party dependencies to my code and I would like to.. write to the new .xlsx format yet but they are working on adding that functionality in. It's very simple small and easy to.. only work for the older Excel format .xls files but may be adding support in the future for newer 2007 2010 formats. You can..

What is the correct way to create a single instance application?

http://stackoverflow.com/questions/19147/what-is-the-correct-way-to-create-a-single-instance-application

use the Microsoft.VisualBasic assembly and I'd rather not add an unnecessary dependency to my project. Second the article..

What is a good pattern for using a Global Mutex in C#?

http://stackoverflow.com/questions/229565/what-is-a-good-pattern-for-using-a-global-mutex-in-c

mutex new Mutex false mutexId edited by Jeremy Wiebe to add example of setting up security for multi user usage edited.. Perform your work here. finally edited by acidzombie24 added if statemnet if hasHandle mutex.ReleaseMutex share improve..

When to Use Static Classes in C#

http://stackoverflow.com/questions/241339/when-to-use-static-classes-in-c-sharp

As it's a static method we can't. Sure if we just need to add functionality either before or after the old method we can create.. As functionality grows a couple of new parameters are added. Soon further parameters are added that are optional so we.. of new parameters are added. Soon further parameters are added that are optional so we create overloads of the method or..

How to Deserialize XML document

http://stackoverflow.com/questions/364253/how-to-deserialize-xml-document

reader.Close And the slightly tweaked xml I needed to add a new element to wrap Cars ...Net is picky about deserializing..

Call ASP.NET Function From Javascript?

http://stackoverflow.com/questions/3713/call-asp-net-function-from-javascript

code file assuming you are using C# and .NET 2.0 or later add the following Interface to your Page Class to make it look like.. System.Web.UI.Page IPostBackEventHandler ii. This should add using Tab Tab this function to your code file public void RaisePostBackEvent..

Good or bad practice for Dialogs in wpf with MVVM?

http://stackoverflow.com/questions/3801681/good-or-bad-practice-for-dialogs-in-wpf-with-mvvm

in wpf with MVVM I lately had the problem of creating add and edit dialogs for my wpf app. All I want to do in my code..

Dynamic LINQ OrderBy on IEnumerable<T>

http://stackoverflow.com/questions/41244/dynamic-linq-orderby-on-ienumerablet

properties. To get it working with IEnumerable T you could add some wrapper methods that go via AsQueryable but the code below..

C# String enums

http://stackoverflow.com/questions/424366/c-sharp-string-enums

value public string Value get return _value Then I can add this attribute to my enumerator public enum AuthenticationMethod.. Update Explicit or implicit type conversion can be done by adding static field with mapping private static readonly Dictionary.. mapping in instance constructor instance name this and adding user defined type conversion operator public static explicit..

How do I make a textbox that only accepts numbers?

http://stackoverflow.com/questions/463299/how-do-i-make-a-textbox-that-only-accepts-numbers

TextBox shouldn't allow decimal places. You could also add a check for ' ' if your TextBox should allow negative values...

VS2010 does not show unhandled exception message in a WinForms Application on a 64-bit version of Windows

http://stackoverflow.com/questions/4933958/vs2010-does-not-show-unhandled-exception-message-in-a-winforms-application-on-a

new Windows Forms Application C# .NET Framework 4 VS2010 2 add the following code to the Form1_Load handler int vara 5 varb..

Creating a blocking Queue<T> in .NET?

http://stackoverflow.com/questions/530211/creating-a-blocking-queuet-in-net

T in .NET I have a scenario where I have multiple threads adding to a queue and multiple threads reading from the same queue... all threads that are filling the queue will be blocked on add until an item is removed from the queue. The solution below.. T item Trace.WriteLine string.Format BlockingCollection add waiting 0 Thread.CurrentThread.ManagedThreadId _FullEvent.WaitOne..

How do I convert Word files to PDF programmatically?

http://stackoverflow.com/questions/607669/how-do-i-convert-word-files-to-pdf-programmatically

that worked for me. It uses Word 2007 with the Save As PDF add in installed. It searches a directory for .doc files opens them.. and then saves them as a PDF. Note that you'll need to add a reference to Microsoft.Office.Interop.Word to the solution...

Random row from Linq to Sql

http://stackoverflow.com/questions/648196/random-row-from-linq-to-sql

at the database by using a fake UDF in a partial class add a method to the data context partial class MyDataContext Function..

How to use HTML Agility pack

http://stackoverflow.com/questions/846994/how-to-use-html-agility-pack

build the HTMLAgilityPack solution. In your application add a reference to HTMLAgilityPack.dll in the HTMLAgilityPack Debug..

How to use localization in C#

http://stackoverflow.com/questions/1142802/how-to-use-localization-in-c-sharp

c# localization cultureinfo share improve this question Add a Resource file to your project you can call it strings.resx.. Resource file to your project you can call it strings.resx Add a string resouce in the resx file and give it a good name example.. the fr part this one will contain resources in French . Add a string resource with the same name as in strings.resx but..

Solution for overloaded operator constraint in .NET generics

http://stackoverflow.com/questions/147646/solution-for-overloaded-operator-constraint-in-net-generics

to operators with generics such as T result Operator.Add first second implicit T here It can be downloaded as part of.. implicit T here It can be downloaded as part of MiscUtil Additionally in C# 4.0 this becomes possible via dynamic static.. in C# 4.0 this becomes possible via dynamic static T Add T T x T y dynamic dx x dy y return dx dy I also had at one point..

Create Excel (.XLS and .XLSX) file from C# [closed]

http://stackoverflow.com/questions/151005/create-excel-xls-and-xlsx-file-from-c-sharp

adptr.SelectCommand cmd adptr.Fill dt con.Close Add the table to the data set ds.Tables.Add dt Here's the easy part... dt con.Close Add the table to the data set ds.Tables.Add dt Here's the easy part. Create the Excel worksheet from the..

.NET Process Monitor

http://stackoverflow.com/questions/1986249/net-process-monitor

with an example. Start a new Console application Project Add Reference select System.Management. Paste this code using System..

Creating Wizards for Windows Forms in C# [closed]

http://stackoverflow.com/questions/2340566/creating-wizards-for-windows-forms-in-c-sharp

runtime. Still easy to do by processing a Windows message. Add a new class to your form and paste the code shown below. Compile...

Getting key of value of a generic Dictionary?

http://stackoverflow.com/questions/255341/getting-key-of-value-of-a-generic-dictionary

int string greek new Dictionary int string greek.Add 1 Alpha greek.Add 2 Beta string secondGreek greek 2 Beta But.. greek new Dictionary int string greek.Add 1 Alpha greek.Add 2 Beta string secondGreek greek 2 Beta But is there a simple.. IList TSecond EmptySecondList new TSecond 0 public void Add TFirst first TSecond second IList TFirst firsts IList TSecond..

How to enable assembly bind failure logging (Fusion) in .NET

http://stackoverflow.com/questions/255669/how-to-enable-assembly-bind-failure-logging-fusion-in-net

vb.net binding assemblies share improve this question Add the following values to HKEY_LOCAL_MACHINE SOFTWARE Microsoft.. values to HKEY_LOCAL_MACHINE SOFTWARE Microsoft Fusion Add DWORD ForceLog set value to 1 DWORD LogFailures set value to..

How to force my .NET App to run as administrator on Windows 7?

http://stackoverflow.com/questions/2818179/how-to-force-my-net-app-to-run-as-administrator-on-windows-7

in the program. This works on VS2008 and higher Project Add New Item select Application Manifest File . Change the requestedExecutionLevel..

Is there a string math evaluator in .NET?

http://stackoverflow.com/questions/355062/is-there-a-string-math-evaluator-in-net

Edit The ScriptControl is a COM object. In the Add reference dialog of the project select the COM tab and scroll..

C# - The foreach identifier and closures

http://stackoverflow.com/questions/512166/c-sharp-the-foreach-identifier-and-closures

ListOfFoo Thread thread new Thread f.DoSomething threads.Add thread thread.Start var threads new List Thread foreach Foo.. Foo f2 f Thread thread new Thread f2.DoSomething threads.Add thread thread.Start Update As pointed out in Jon Skeet's answer.. Console.ReadLine Outputs at random 1 3 4 4 5 7 7 8 9 9 Add a temp variable and it works foreach int i in data int j i..

When to use struct in C#?

http://stackoverflow.com/questions/521298/when-to-use-struct-in-c

well over 16 bytes Entry has an undetermined lifetime from Add to Remove Clear or garbage collection And ... 4. Both structs.. as a reference type I had to insert the following code Added to satisfy initialization of entry elements this is where..

Creating a blocking Queue<T> in .NET?

http://stackoverflow.com/questions/530211/creating-a-blocking-queuet-in-net

int maxSize MaxSize maxSize internal void Add T item Trace.WriteLine string.Format BlockingCollection add.. _FullEvent.WaitOne List.Add item Trace.WriteLine string.Format BlockingCollection item added..

Developing Internet Explorer Extensions?

http://stackoverflow.com/questions/5643819/developing-internet-explorer-extensions

Hope you understand Creating a Working Internet Explorer 8 Addon I am using Visual Studio 2010 C# 4 .Net Framework 4 so some.. a class library. I called mine InternetExplorerExtension . Add these references to the project Interop.SHDocVw Microsoft.mshtml.. Reference Include System.Xml Create the following files IEAddon.cs using System using System.Collections.Generic using System.Runtime.InteropServices..

How to associate a file extension to the current executable in C#

http://stackoverflow.com/questions/69761/how-to-associate-a-file-extension-to-the-current-executable-in-c-sharp

HKEY_CLASSES_ROOT with the name set to Acme.TextFile . Add a subkey called DefaultIcon and set the default value of the.. containing the icon you wish to use for this file type. Add another sibling called shell . Under the shell key add a key..

Create code first, many to many, with additional fields in association table

http://stackoverflow.com/questions/7050404/create-code-first-many-to-many-with-additional-fields-in-association-table

Comment comment2 Something 102 context.MemberComments.Add memberComment1 will also add member1 and comment1 context.MemberComments.Add.. will also add member1 and comment1 context.MemberComments.Add memberComment2 will also add comment2 context.SaveChanges 2.. will also add comment2 context.SaveChanges 2 Add a third comment of member1 var member1 context.Members.Where..

Changing column default values in EF5 Code First

http://stackoverflow.com/questions/11974439/changing-column-default-values-in-ef5-code-first

value Edit Here is the SQL generated ALTER TABLE Config ADD CONSTRAINT DF_DefaultTaxPerDollar DEFAULT 0.087 FOR DefaultTaxPerDollar..

Why is there no overload of Interlocked.Add that accepts Doubles as parameters?

http://stackoverflow.com/questions/1400465/why-is-there-no-overload-of-interlocked-add-that-accepts-doubles-as-parameters

prefixing the following instructions BT BTS BTR BTC XCHG XADD ADD OR ADC SBB AND SUB XOR NOT NEG INC DEC You'll note that.. the following instructions BT BTS BTR BTC XCHG XADD ADD OR ADC SBB AND SUB XOR NOT NEG INC DEC You'll note that these.. much map to the interlocked methods. Unfortunately the ADD functions for non integer types are not supported here. Add..

How to create “embedded” SQL 2008 database file if it doesn't exist?

http://stackoverflow.com/questions/1715691/how-to-create-embedded-sql-2008-database-file-if-it-doesnt-exist

Notes nvarchar MAX NULL ALTER TABLE AAASchemaVersion ADD CONSTRAINT PK_Version PRIMARY KEY CLUSTERED Version INSERT.. NULL UserName nvarchar 100 NOT NULL ALTER TABLE AuditUser ADD CONSTRAINT PK_AuditUser PRIMARY KEY CLUSTERED ID CONSTRAINT..

C# 4.0/EF - Server-generated keys and server-generated values are not supported by SQL Server Compact

http://stackoverflow.com/questions/2734424/c-sharp-4-0-ef-server-generated-keys-and-server-generated-values-are-not-suppo

NOT NULL new column ALTER TABLE ImportDoorAccesses ADD CONSTRAINT PK_ImportDoorAccesses PRIMARY KEY ID The constraint.. The constraint used to be ALTER TABLE ImportDoorAccesses ADD CONSTRAINT PK_ImportDoorAccesses PRIMARY KEY DoorOpen UserName..

Is it possible to use SqlGeography with Linq to Sql?

http://stackoverflow.com/questions/2845767/is-it-possible-to-use-sqlgeography-with-linq-to-sql

. In other words some DDL like this ALTER TABLE FooTable ADD LocationData AS CAST Location AS varbinary max Then remove the..

Entity Framework: Alternate solution to using non primary unique keys in an association

http://stackoverflow.com/questions/3992236/entity-framework-alternate-solution-to-using-non-primary-unique-keys-in-an-asso

CLUSTERED PersonId ASC ALTER TABLE dbo . Person WITH CHECK ADD CONSTRAINT FK_Person_PersonType FOREIGN KEY TypeCode REFERENCES..

How can I generate database tables from C# classes?

http://stackoverflow.com/questions/47239/how-can-i-generate-database-tables-from-c-sharp-classes

TABLE table.ClassName WITH NOCHECK Console.WriteLine ADD CONSTRAINT FK_ field.Key FOREIGN KEY field.Key REFERENCES t2.ClassName.. AFKInt BIGINT GO ALTER TABLE FakeDataClass WITH NOCHECK ADD CONSTRAINT FK_AFKReference FOREIGN KEY AFKReference REFERENCES..

ASP.NET MVC 3 Model-binding and form fields

http://stackoverflow.com/questions/5341917/asp-net-mvc-3-model-binding-and-form-fields

PostComment postComment div BELOW IS THE ADD COMMENT FORM div id addComment @using Html.BeginForm AddComment..

Can you help me understand in a practical example the usage abstract classes vs interfaces?

http://stackoverflow.com/questions/627199/can-you-help-me-understand-in-a-practical-example-the-usage-abstract-classes-vs

Your task is to take the supplied program shell and ADD the appropriate classes and corresponding class members methods..

Generating Delegate Types dynamically in C#

http://stackoverflow.com/questions/773099/generating-delegate-types-dynamically-in-c-sharp

are represented as xml. For example we represent a b as ADD param type decimal A parameter param type decimal B parameter.. type decimal A parameter param type decimal B parameter ADD We now want this to be exposed as Func decimal decimal decimal..