¡@

Home 

c# Programming Glossary: on

Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on

http://stackoverflow.com/questions/142003/cross-thread-operation-not-valid-control-accessed-from-a-thread-other-than-the

thread operation not valid Control accessed from a thread other than the thread.. thread operation not valid Control accessed from a thread other than the thread it was created.. from a thread other than the thread it was created on I have a scenario. Windows Forms C# .NET There is a main form..

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

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

Spreadsheet with C# Ideally I would like open source so I don't have to add any third party dependencies to my code and I.. using Excel directly to create the file using OLE Automation. The .CSV file solution is easy and is the current way I am.. create the file using OLE Automation. The .CSV file solution is easy and is the current way I am handling this but I would..

How to properly clean up Excel interop objects

http://stackoverflow.com/questions/158706/how-to-properly-clean-up-excel-interop-objects

objects I'm using the Excel interop in C# ApplicationClass and have placed the following code in my finally clause.. is still in the background even after I close Excel. It is only released once my application is manually closed. Anyone realize.. background even after I close Excel. It is only released once my application is manually closed. Anyone realize what I am..

Sending email in .NET through Gmail

http://stackoverflow.com/questions/32260/sending-email-in-net-through-gmail

email in .NET through Gmail Instead of relying on my host to send email I was thinking of sending the messages.. the messages though my Gmail account. The emails are personalized emails to the bands I play on my show. Is it possible.. The emails are personalized emails to the bands I play on my show. Is it possible to do c# .net email gmail share improve..

Dynamic LINQ OrderBy on IEnumerable<T>

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

LINQ OrderBy on IEnumerable T I found an example in the VS2008 Examples for.. Age DESC for ordering. Unfortunately the method included only works on IQueryable T . Is there any way to get this functionality.. for ordering. Unfortunately the method included only works on IQueryable T . Is there any way to get this functionality on..

Why are mutable structs evil?

http://stackoverflow.com/questions/441309/why-are-mutable-structs-evil

are mutable structs evil Following the discussions here on SO I already read several times the remark that mutable.. are mutable structs evil Following the discussions here on SO I already read several times the remark that mutable structs.. mutable structs are evil like in the answer to this question . What's the actual problem with mutability and structs c#..

Random number generator only generating one random number

http://stackoverflow.com/questions/767999/random-number-generator-only-generating-one-random-number

number generator only generating one random number I have the following function.. number generator only generating one random number I have the following function Function to get.. generating one random number I have the following function Function to get random number public static int RandomNumber..

Deep cloning objects in C#

http://stackoverflow.com/questions/78536/deep-cloning-objects-in-c-sharp

cloning objects in C# I want to do something like myObject myObj.. Create and fill a new object myObject newObj myObj.Clone And then make changes to the new object that are not reflected.. object that are not reflected in the original object. I don't often need this functionality so when it's been necessary..

Easier way to start debugging a windows service in C#

http://stackoverflow.com/questions/125964/easier-way-to-start-debugging-a-windows-service-in-c-sharp

DEBUG_SERVICE private static void DebugMode Debugger.Break On your OnStart just call this method public override void OnStart.. private static void DebugMode Debugger.Break On your OnStart just call this method public override void OnStart DebugMode.. On your OnStart just call this method public override void OnStart DebugMode ... do the rest There the code will only be enabled..

Generating an Xml Serialization assembly as part of my build

http://stackoverflow.com/questions/134224/generating-an-xml-serialization-assembly-as-part-of-my-build

automatically Update The Generate Serialization Assembly On setting doesn't appear to do anything. c# xml xml serialization.. and SGen our own like so Target Name AfterBuild DependsOnTargets AssignTargetPaths Compile ResolveKeySource Inputs MSBuildAllProjects.. Files TargetDir TargetName .XmlSerializers.dll ContinueOnError true SGen BuildAssemblyName TargetFileName BuildAssemblyPath..

How can I programmatically generate keypress events in C#?

http://stackoverflow.com/questions/1645815/how-can-i-programmatically-generate-keypress-events-in-c

text composition and IME. This is normally what you want. On the other hand if you really do what to simulate actual keyboard..

CryptographicException: Padding is invalid and cannot be removed and Validation of viewstate MAC failed

http://stackoverflow.com/questions/1821243/cryptographicexception-padding-is-invalid-and-cannot-be-removed-and-validation

my Page Base for all of my pages protected override void OnInit EventArgs e const string viewStateKey big key value Page.ViewStateUserKey.. the view state was changes by hand or was totally empty. On error I just redirect him to the same page... Here is what I.. it press the button unless this input have been loaded . One more comment the __EVENTVALIDATION is not always presents so..

C# - How to get Program Files (x86) on Windows Vista 64 bit

http://stackoverflow.com/questions/194157/c-sharp-how-to-get-program-files-x86-on-windows-vista-64-bit

DOS application and I couldn't think of another method . On Windows XP and 32 bit versions of Windows Vista this works fine...

HTML.ActionLink method

http://stackoverflow.com/questions/200476/html-actionlink-method

public ActionResult Login int id return View Hi id On a page that is not located at the Item folder where ItemController..

Why does C# not provide the C++ style 'friend' keyword?

http://stackoverflow.com/questions/203616/why-does-c-sharp-not-provide-the-c-style-friend-keyword

like to use it in C# too. But I bet because of C#'s pure OOness compared to C 's pseudo OOness MS decided that because Java.. I bet because of C#'s pure OOness compared to C 's pseudo OOness MS decided that because Java has no friend keyword C# shouldn't.. has no friend keyword C# shouldn't either just kidding On a serious note internal is not as good as friend but it does..

Getting the size of a field in bytes with C#

http://stackoverflow.com/questions/207592/getting-the-size-of-a-field-in-bytes-with-c-sharp

FourBytes byte a b c d class FiveBytes byte a b c d e On my x86 box an instance of FourBytes takes 12 bytes including..

Why is the C# “as” operator so popular? [closed]

http://stackoverflow.com/questions/2139798/why-is-the-c-sharp-as-operator-so-popular

not followed by a null check somewhere is a code smell. On the other hand if you are not sure about the cast and expect..

What is a message pump?

http://stackoverflow.com/questions/2222365/what-is-a-message-pump

to have the window procedure of that window execute code. On the STA thread. The message loop ensures that this code runs...

Transactions in .net

http://stackoverflow.com/questions/224689/transactions-in-net

. All in all a very very useful object. Some caveats On SQL Server 2000 a TransactionScope will go to DTC immediately..

IIS Express enable external request

http://stackoverflow.com/questions/3313616/iis-express-enable-external-request

. Here is the pertinent part of that post summarized On Vista and Win7 run the following command from an administrative..

Best Free Controls for .NET [closed]

http://stackoverflow.com/questions/361271/best-free-controls-for-net

eXcentrics .NET Server Controls iTextSharp Free PDF On The Fly generator WPF XamDataGrid XCeed's WPF DataGrid Graphs..

Entity Framework 4 - AddObject vs Attach

http://stackoverflow.com/questions/3920111/entity-framework-4-addobject-vs-attach

existing Person two queries are actually being executed. One to retrieve the Person .SingleOrDefault and another to perform.. the database. ObjectContext.Attach and ObjectSet.Attach On the other hand Attach is used for entities that already exist..

windows service (allow service to interact with desktop)

http://stackoverflow.com/questions/4237225/windows-service-allow-service-to-interact-with-desktop

and understand them. There is a checkbox under the Log On tab in the properties window for a Windows service that is called..

Show Console in Windows Application?

http://stackoverflow.com/questions/472282/show-console-in-windows-application

in either GUI windows mode or command line console mode On the surface of it this would seem easy you create a Console..

Casting vs using the 'as' keyword in the CLR

http://stackoverflow.com/questions/496096/casting-vs-using-the-as-keyword-in-the-clr

and because of that I've ended using a lot of interfaces. One of my goals is to program to an interface not an implementation... As and null check 0 1 len long sw.ElapsedMilliseconds On my laptop these all execute in about 60ms. Two things to note..

How would you code an efficient Circular Buffer in Java or C#

http://stackoverflow.com/questions/590069/how-would-you-code-an-efficient-circular-buffer-in-java-or-c-sharp

.Add and I guess .List where I retrieve all the entries. On second thought Retrieval I think should be done via an indexer... 3 for int i 0 i 10 i System.out.println Start b b.add One System.out.println One b b.add Two System.out.println Two b.. i System.out.println Start b b.add One System.out.println One b b.add Two System.out.println Two b System.out.println Got..

What is the minimum client footprint required to connect C# to an Oracle database?

http://stackoverflow.com/questions/70602/what-is-the-minimum-client-footprint-required-to-connect-c-sharp-to-an-oracle-da

v11 oci.dll orannzsbb11.dll oraociei11.dll On a x86 platform add the CRT DLL for Visual Studio 2003 msvcr71.dll..

Event Bubbling and MVP: ASP.NET

http://stackoverflow.com/questions/8851933/event-bubbling-and-mvp-asp-net

for add days an event is raised œmyBtnAddDaysClickedEvent On the MonthViewControl there is a label that shows the month of.. presenter Delegate public delegate void OnAddDaysClickedDelegate string strValue Event public event OnAddDaysClickedDelegate.. string strValue Event public event OnAddDaysClickedDelegate myBtnAddDaysClickedEvent Provision for..

LINQ to SQL - Left Outer Join with multiple join conditions

http://stackoverflow.com/questions/1122942/linq-to-sql-left-outer-join-with-multiple-join-conditions

SELECT f.value FROM period as p LEFT OUTER JOIN facts AS f ON p.id f.periodid AND f.otherid 17 WHERE p.companyid 100 I have.. SELECT f.value FROM period as p LEFT OUTER JOIN facts AS f ON p.id f.periodid WHERE p.companyid 100 AND f.otherid 17 which..

C#, regular expressions : how to parse comma-separated values, where some values might be quoted strings themselves containing commas

http://stackoverflow.com/questions/1189416/c-regular-expressions-how-to-parse-comma-separated-values-where-some-values

public static void Main string myString cat dog 0 OFF 1 ON lion tiger 'R red G green B blue' bear Console.WriteLine nmyString.. Output in part appears as follows 0 cat 1 dog 2 0 OFF 3 1 ON 4 lion 5 tiger 6 'R red 7 G green 8 B blue' 9 bear However desired.. 9 bear However desired output is 0 cat 1 dog 2 0 OFF 1 ON 3 lion 4 tiger 5 R red G green B blue 6 bear c# regex csv ..

Soft Delete Entity Framework Code First

http://stackoverflow.com/questions/12698793/soft-delete-entity-framework-code-first

override void Up Sql String.Format CREATE UNIQUE INDEX 0 ON dbo.Organisations Name WHERE IsDeleted 0 IX_NaturalKey And that..

SQL Query slow in .NET application but instantaneous in SQL Server Management Studio

http://stackoverflow.com/questions/2736638/sql-query-slow-in-net-application-but-instantaneous-in-sql-server-management-st

FROM TrustAccountLog AS tal INNER JOIN TrustAccount ta ON ta.TrustAccountID tal.TrustAccountID INNER JOIN Users usr ON.. ta.TrustAccountID tal.TrustAccountID INNER JOIN Users usr ON usr.UserID ta.UserID WHERE usr.UserID 70402 AND ta.TrustAccountID.. FROM TrustAccountLog AS tal INNER JOIN TrustAccount ta ON ta.TrustAccountID tal.TrustAccountID INNER JOIN Users usr ON..

multimap in .NET

http://stackoverflow.com/questions/380595/multimap-in-net

with the distribution. THIS SOFTWARE IS PROVIDED BY SOLUTIONS DESIGN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING.. PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOLUTIONS DESIGN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL.. ARE DISCLAIMED. IN NO EVENT SHALL SOLUTIONS DESIGN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL..

Unique key with EF code first

http://stackoverflow.com/questions/5701608/unique-key-with-ef-code-first

CREATE UNIQUE INDEX IX_Category_Title ON Categories Title And you must set this initializer in the bootstrap..

LINQ - Left Join, Group By, and Count

http://stackoverflow.com/questions/695506/linq-left-join-group-by-and-count

c.ChildId FROM ParentTable p LEFT OUTER JOIN ChildTable c ON p.ParentId c.ChildParentId GROUP BY p.ParentId How can I translate..

Getting return value from stored procedure in C#

http://stackoverflow.com/questions/706361/getting-return-value-from-stored-procedure-in-c-sharp

procedure in C# I have the following query set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE dbo . Validate @a.. following query set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE dbo . Validate @a varchar 50 @b varchar 50..