¡@

Home 

c# Programming Glossary: set

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

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

code is the single line at the bottom Create the data set and table DataSet ds new DataSet New_DataSet DataTable dt new.. cmd adptr.Fill dt con.Close Add the table to the data set ds.Tables.Add dt Here's the easy part. Create the Excel worksheet.. the easy part. Create the Excel worksheet from the data set ExcelLibrary.DataSetHelper.CreateWorkbook MyExcelFile.xls ds..

Randomize a List<T> in C#

http://stackoverflow.com/questions/273313/randomize-a-listt-in-c-sharp

the order of a generic list in C# I've got a finite set of 75 numbers in a list I would like to assign a random order..

What is the difference between a field and a property in C#?

http://stackoverflow.com/questions/295104/what-is-the-difference-between-a-field-and-a-property-in-c

always be kept private to a class and accessed via get and set properties. Properties provide a level of abstraction allowing.. underlying field public string MyField get return _myField set _myField value @Kent points out that Properties are not required..

How to Deserialize XML document

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

StockNumber public string StockNumber get set System.Xml.Serialization.XmlElementAttribute Make public string.. Make public string Make get set System.Xml.Serialization.XmlElementAttribute Model public string.. Model public string Model get set . System.Xml.Serialization.XmlRootAttribute Cars Namespace IsNullable..

Why is it important to override GetHashCode when Equals method is overridden?

http://stackoverflow.com/questions/371328/why-is-it-important-to-override-gethashcode-when-equals-method-is-overridden

the following class public class Foo public int FooId get set public string FooName get set public override bool Equals object.. Foo public int FooId get set public string FooName get set public override bool Equals object obj Foo fooItem obj as Foo..

Use of Application.DoEvents()

http://stackoverflow.com/questions/5181777/use-of-application-doevents

it delivers everything else as well. And there's a set of notifications that cause trouble. They come from about 3..

Creating a blocking Queue<T> in .NET?

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

be worth changing this into a proper QUEUE private AutoResetEvent _FullEvent new AutoResetEvent false internal T this int.. a proper QUEUE private AutoResetEvent _FullEvent new AutoResetEvent false internal T this int i get return T List i private.. int _MaxSize internal int MaxSize get return _MaxSize set _MaxSize value checkSize internal BlockingCollection int maxSize..

What does the [Flags] Enum Attribute mean in C#?

http://stackoverflow.com/questions/8447/what-does-the-flags-enum-attribute-mean-in-c

MyColor.Yellow MyColor.Yellow Yellow has been set... if myProperties.AllowedColors MyColor.Green MyColor.Green.. MyColor.Green MyColor.Green Green has been set... or in .NET 4 and later if myProperties.AllowedColors.HasFlag.. MyColor.Yellow Yellow has been set... Under the covers This works because you previously used multiples..

How to use HTML Agility pack

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

new HtmlAgilityPack.HtmlDocument There are various options set as needed htmlDoc.OptionFixNestedTags true filePath is a path..

Set focus on textbox in WPF from view model (C#) & wPF

http://stackoverflow.com/questions/1356045/set-focus-on-textbox-in-wpf-from-view-model-c-wpf

focus on textbox in WPF from view model C# wPF I have a TextBox.. bool obj.GetValue IsFocusedProperty public static void SetIsFocused DependencyObject obj bool value obj.SetValue IsFocusedProperty.. void SetIsFocused DependencyObject obj bool value obj.SetValue IsFocusedProperty value public static readonly DependencyProperty..

ObservableCollection not noticing when Item in it changes (even with INotifyPropertyChanged)

http://stackoverflow.com/questions/1427471/observablecollection-not-noticing-when-item-in-it-changes-even-with-inotifyprop

share improve this question The ContentList's Set method will not get called when you change a value inside the..

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

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

It's very simple small and easy to use. Plus it has a DataSetHelper that lets you use DataSets and DataTables to easily work.. to use. Plus it has a DataSetHelper that lets you use DataSets and DataTables to easily work with Excel data. ExcelLibrary.. line at the bottom Create the data set and table DataSet ds new DataSet New_DataSet DataTable dt new DataTable New_DataTable..

Using global keyboard hook (WH_KEYBOARD_LL) in WPF / C#

http://stackoverflow.com/questions/1639331/using-global-keyboard-hook-wh-keyboard-ll-in-wpf-c-sharp

InterceptKeys.LowLevelKeyboardProc LowLevelKeyboardProc Set the hook hookId InterceptKeys.SetHook hookedLowLevelKeyboardProc.. LowLevelKeyboardProc Set the hook hookId InterceptKeys.SetHook hookedLowLevelKeyboardProc Assign the asynchronous callback.. WM_SYSKEYUP 261 WM_SYSKEYDOWN 260 public static IntPtr SetHook LowLevelKeyboardProc proc using Process curProcess Process.GetCurrentProcess..

How to stop BackgroundWorker on Form's Closing event?

http://stackoverflow.com/questions/1731384/how-to-stop-backgroundworker-on-forms-closing-event

that I know is to actually cancel the FormClosing event. Set e.Cancel true if the BGW is still running and set a flag to..

Using CookieContainer with WebClient class

http://stackoverflow.com/questions/1777221/using-cookiecontainer-with-webclient-class

header before making the request and then pull out the Set Cookies header on the response. There are helper methods on.. creating and parsing these headers easier CookieContainer.SetCookies and CookieContainer.GetCookieHeader respectively. I prefer..

Multipart forms from C# client

http://stackoverflow.com/questions/219827/multipart-forms-from-c-sharp-client

default is AaB03x string boundary ConfigurationManager.AppSettings ContentBoundary .ToString StringBuilder sb new StringBuilder.. PostData byte buffer encoding.GetBytes pData.GetPostData Set content length of our data oRequest.ContentLength buffer.Length..

Windows service and timer

http://stackoverflow.com/questions/246697/windows-service-and-timer

timer. aTimer.Elapsed new ElapsedEventHandler OnTimedEvent Set the Interval to 2 seconds 2000 milliseconds . aTimer.Interval.. Reset the counter and signal Main. invokeCount 0 autoEvent.Set Both examples comes from the MSDN pages. share improve this..

Tips for optimizing C#/.NET programs [closed]

http://stackoverflow.com/questions/2473666/tips-for-optimizing-c-net-programs

it as an engineering problem like any other problem Set meaningful measurable customer focused goals. Build test suites..

How do I create a custom membership provider for ASP.NET MVC 2?

http://stackoverflow.com/questions/2771094/how-do-i-create-a-custom-membership-provider-for-asp-net-mvc-2

providers roleManager ... system.web 3 Set the Authorize Roles xxx yyy above the wanted Controller Action.. filterContext if AuthorizeCore filterContext.HttpContext SetCachePolicy filterContext else if filterContext.HttpContext.User.Identity.IsAuthenticated.. SuperUser is authenticated and is in the SuperUser role SetCachePolicy filterContext else ViewDataDictionary viewData..

Developing Internet Explorer Extensions?

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

writeable_registry.CreateSubKey RegData registryKey.SetValue Data TextToHighlight writeable_registry.Close private.. writeable_registry.CreateSubKey RegData registryKey.SetValue Data TextToHighlight if registryKey null TextToHighlight.. Implementation of IObjectWithSite int IObjectWithSite.SetSite object site this.site site if site null LoadOptions ..

What is differences between Multidimensional array and Array of Arrays in C#?

http://stackoverflow.com/questions/597720/what-is-differences-between-multidimensional-array-and-array-of-arrays-in-c

always slower. Consider the following methods static void SetElementAt int array int i int j int value array i j value static.. array int i int j int value array i j value static void SetElementAt int array int i int j int value array i j value Their.. be the following .method private hidebysig static void SetElementAt int32 'array' int32 i int32 j int32 'value'..

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

with the name set to your file extension eg .txt . Set the default value of this key to a unique name for your file..

Validating an XML against referenced XSD in C#

http://stackoverflow.com/questions/751511/validating-an-xml-against-referenced-xsd-in-c-sharp

improve this question You need to create an XmlReaderSettings instance and pass that to your XmlReader when you create.. System.IO public class ValidXSD public static void Main Set the validation settings. XmlReaderSettings settings new XmlReaderSettings.. static void Main Set the validation settings. XmlReaderSettings settings new XmlReaderSettings settings.ValidationType..

C# Login to Website via program

http://stackoverflow.com/questions/930807/c-sharp-login-to-website-via-program

is to post the login form the second is recovering the Set cookie header and sending that back to the server as Cookie.. which I'm fairly confident it is as that page returns a Set cookie header which includes PHPSESSID . POSTing to the login.. WebResponse resp req.GetResponse cookieHeader resp.Headers Set cookie Here's an example of what you should see in the Set cookie..

Most common C# bitwise operations on enums

http://stackoverflow.com/questions/93744/most-common-c-sharp-bitwise-operations-on-enums

be nice to have. For example flags flags FlagsEnum.Bit4 Set bit 4. or if flags FlagsEnum.Bit4 FlagsEnum.Bit4 Is there a..

How to execute a stored procedure within C# program

http://stackoverflow.com/questions/1260952/how-to-execute-a-stored-procedure-within-c-sharp-program

dbo.test as DECLARE @command as varchar 1000 @i int SET @i 0 WHILE @i 5 BEGIN Print 'I VALUE ' CONVERT varchar 20 @i.. BEGIN Print 'I VALUE ' CONVERT varchar 20 @i EXEC @command SET @i @i 1 END EDITED using System using System.Collections.Generic..

Soft Delete Entity Framework Code First

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

Database.ExecuteSqlCommand String.Format UPDATE 0 SET IsDeleted 1 WHERE ID @id tableName new SqlParameter id e.ID..

How to Generate Unique Public and Private Key via RSA

http://stackoverflow.com/questions/1307204/how-to-generate-unique-public-and-private-key-via-rsa

to the new public key. myCmd.CommandText UPDATE Settings SET PublicKey @PublicKey myCmd.Parameters.AddWithValue @PublicKey..

Sharing sessions across applications using the ASP.NET Session State Service

http://stackoverflow.com/questions/2868316/sharing-sessions-across-applications-using-the-asp-net-session-state-service

the connection string. DECLARE @connStrAppName nvarchar 50 SET @connStrAppName APP_NAME .NET SQLClient Data Provider is the.. apps IF @connStrAppName '.NET SQLClient Data Provider' SET @appName @connStrAppName end change SET @appName LOWER @appName..

Exclusive access could not be obtained because the database is in use

http://stackoverflow.com/questions/4046708/exclusive-access-could-not-be-obtained-because-the-database-is-in-use

MS SQL Server to kick all users off is ALTER DATABASE MyDB SET Single_User WITH Rollback Immediate GO Now you can perform your..

Is there a way to dynamically execute a string in .net, similar to eval() in javascript or dynamic sql in sql?

http://stackoverflow.com/questions/508213/is-there-a-way-to-dynamically-execute-a-string-in-net-similar-to-eval-in-jav

arbitrary sql into my @manipulation something like this SET @result REPLACE REPLACE @s '.' ' ' ' ' '' Yes this would require..

How to monitor SQL Server table changes by using c#?

http://stackoverflow.com/questions/5288434/how-to-monitor-sql-server-table-changes-by-using-c

low number of client notifications . ALTER DATABASE UrDb SET ENABLE_BROKER Implement the OnChange event to get notified void..

How to SET extended file properties?

http://stackoverflow.com/questions/5337683/how-to-set-extended-file-properties

to SET extended file properties I am talking about properties you.. by using shell32.dll class and I asumed that I could also SET them with the same class but it seems like writing extended.. to do that. I was unable to find a clear solution for SETTING properties though there are a lot about getting them . Also..

How can I determine the parameters required by an arbitrary piece of T-SQL?

http://stackoverflow.com/questions/5792507/how-can-i-determine-the-parameters-required-by-an-arbitrary-piece-of-t-sql

in order to describe the results exec sp_executesql N'SET FMTONLY OFF SET FMTONLY ON SELECT @Foo Foo ''@Bar'' Bar @Baz.. describe the results exec sp_executesql N'SET FMTONLY OFF SET FMTONLY ON SELECT @Foo Foo ''@Bar'' Bar @Baz Baz ' N'@Foo sql_variant..

SQL: Update a row and returning a column value with 1 query

http://stackoverflow.com/questions/700786/sql-update-a-row-and-returning-a-column-value-with-1-query

a column value from it. I can do this with UPDATE Items SET Clicks Clicks 1 WHERE Id @Id SELECT Name FROM Items WHERE Id.. this question You want the OUTPUT clause UPDATE Items SET Clicks Clicks 1 OUTPUT INSERTED.Name WHERE Id @Id share improve..

Getting return value from stored procedure in C#

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

dbo . Validate @a varchar 50 @b varchar 50 output AS SET @Password SELECT Password FROM dbo.tblUser WHERE Login @a RETURN..

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated

http://stackoverflow.com/questions/8602395/timeout-expired-the-timeout-period-elapsed-prior-to-completion-of-the-operation

datetime @Online bit As Begin Update OnlineUsers SET Session_End @Session_End Online @Online End i have two methods..