¡@

Home 

c# Programming Glossary: all

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

does some heavy data operation such that if I directly call the UserControl_Load method the UI become nonresponsive for.. at some later stage if InvokeRequired after we've done all the processing this.Invoke new MethodInvoker delegate load..

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

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

closed How can I create an Excel Spreadsheet with C# Ideally I would like open source so I don't have to add any third party.. at a port of the PEAR PHP library Excel Writer that will allow some pretty good XLS data and formatting and it is in the.. and it is in the Excel_97 compatible format that all modern versions of Excel support. The PEAR Excel Writer is here..

Encrypt/Decrypt string in .NET

http://stackoverflow.com/questions/202011/encrypt-decrypt-string-in-net

StreamWriter swEncrypt new StreamWriter csEncrypt Write all data to the stream. swEncrypt.Write plainText outStr Convert.ToBase64String.. outStr Convert.ToBase64String msEncrypt.ToArray finally Clear the RijndaelManaged object. if aesAlg null aesAlg.Clear.. them in a string. plaintext srDecrypt.ReadToEnd finally Clear the RijndaelManaged object. if aesAlg null aesAlg.Clear..

Why are mutable structs evil?

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

which might be around. If your struct is immutable then all automatic copies resulting from being passed by value will be..

Casting vs using the 'as' keyword in the CLR

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

this makes sense. Sorry for the bad example it is all I could think of... Update What is in general the preferred.. answers so far at the time of starting this answer have really explained where it's worth using which. Don't do this Bad code.. value of randomObject between the two. If randomObject really should be an instance of TargetType i.e. if it's not that means..

Use of Application.DoEvents()

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

be used in C# Is this function a way to allow the GUI to catch up with the rest of the app in much the same.. enormous amount of backlash against it but nobody ever really explains why it is bad . The same kind of wisdom as don't mutate.. to grok. Right off the bat almost any Winforms program actually contains a call to DoEvents . It is cleverly disguised however..

Creating a blocking Queue<T> in .NET?

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

from the same queue. If the queue reaches a specific size all threads that are filling the queue will be blocked on add until..

Proper use of the IDisposable interface

http://stackoverflow.com/questions/538060/proper-use-of-the-idisposable-interface

free memory used by MyCollection any faster than it normally would edit So far people have posted some good examples of.. be cleaned up. The garbage collector doesn't know how to call DeleteHandle on a variable of type IntPtr it doesn't know whether.. of type IntPtr it doesn't know whether or not it needs to call DeleteHandle . Note What is an unmanaged resource If you found..

What is the difference between Decimal, Float and Double in C#?

http://stackoverflow.com/questions/618535/what-is-the-difference-between-decimal-float-and-double-in-c

and expect exact results in decimal representations not all decimal numbers are exactly representable in binary floating.. so if you use a binary floating point value you'll actually get an approximation to 0.1. You'll still get approximations.. example. As for what to use when For values which are naturally exact decimals it's good to use decimal. This is usually suitable..

Random number generator only generating one random number

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

Random random new Random return random.Next min max How I call it byte mac new byte 6 for int x 0 x 6 x mac x byte Misc.RandomNumber.. . However if I put a breakpoint two lines below that code all members of the mac array have equal value. Why does that happen.. min max Edit see comments why do we need a lock here Basically Next is going to change the internal state of the Random instance...

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

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

flags rather than a single value. Such collections are usually manipulated using bitwise operators for example myProperties.AllowedColors.. Note that Flags by itself doesn't change this at all all it does is enable a nice representation by the .ToString.. Note that Flags by itself doesn't change this at all all it does is enable a nice representation by the .ToString method..

Is there a way to check if a file is in use?

http://stackoverflow.com/questions/876473/is-there-a-way-to-check-if-a-file-is-in-use

process . I would like to find a way around this but all my Googling has only yielded creating checks by using exception.. hesitation about using exceptions but you can't avoid them all of the time protected virtual bool IsFileLocked FileInfo file.. does not exist has already been processed return true finally if stream null stream.Close file is not locked return false..

C# - Capture screenshot of active window

http://stackoverflow.com/questions/1163761/c-sharp-capture-screenshot-of-active-window

screen capturing application and everything is going fine. All I need to do is capture the active window and take a screenshot..

How to Query an NTP Server using C#?

http://stackoverflow.com/questions/1193955/how-to-query-an-ntp-server-using-c

to Query an NTP Server using C# All I need is a way to query an NTP Server using C# to get the Date..

Parse JSON in C#

http://stackoverflow.com/questions/1212344/parse-json-in-c-sharp

Search API and print it out to the screen EDIT ALL FIXED All results are working fine. Thank you again Dreas Grech using.. www.cheese.com title u003cb u003eCHEESE u003c b u003e.COM All about u003cb u003echeese u003c b u003e . titleNoFormatting CHEESE.COM.. u003echeese u003c b u003e . titleNoFormatting CHEESE.COM All about cheese . content u003cb u003eCheese u003c b u003e everything..

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

that it has done its work. Now came a real problem. All the UI main form and its child usercontrols was created on the..

Graph nodes coordinates evaluation [closed]

http://stackoverflow.com/questions/15579069/graph-nodes-coordinates-evaluation

then evaluate coordinates using some lightweight library. All I need is algorithm which could on dot file and speciefied layout..

How to create and connect custom user buttons/controls with lines using windows forms

http://stackoverflow.com/questions/15819318/how-to-create-and-connect-custom-user-buttons-controls-with-lines-using-windows

TextBoxes under Mid Point in the left panel. The Collapse All CheckBox allows to toggle between full and small boxes as shown..

Simple 2 way encryption for C#

http://stackoverflow.com/questions/165808/simple-2-way-encryption-for-c-sharp

your keys by just assuming that you used this code as is All you have to do is change some of the numbers must be 255 in..

What NoSQL solutions are out there for .NET? [closed]

http://stackoverflow.com/questions/1777103/what-nosql-solutions-are-out-there-for-net

below uses my ServiceStack's open source C# client . All the documentation and tutorials for the ServiceStack's C# Redis.. savedTodo.Id var allTodos redisTodos.GetAll Assert.That allTodos.Count Is.EqualTo 0 To play with this example..

Why Doesn't C# Allow Static Methods to Implement an Interface?

http://stackoverflow.com/questions/259026/why-doesnt-c-sharp-allow-static-methods-to-implement-an-interface

Doesn't C# Allow Static Methods to Implement an Interface Why was C# designed.. string ScreenName ... public class Animal IListItem All animals will be called Animal . public static string ScreenName.. .... public class Person IListItem private string name All persons will be called by their individual names. public string..

Deserialize JSON into C# dynamic object?

http://stackoverflow.com/questions/3142495/deserialize-json-into-c-sharp-dynamic-object

the code slightly to fix a bug and suit my coding style. All you need is this code and a reference to System.Web.Extensions..

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

problem of creating add and edit dialogs for my wpf app. All I want to do in my code was something like this. I mostly use..

How can I create a Product Key for my C# App

http://stackoverflow.com/questions/453030/how-can-i-create-a-product-key-for-my-c-sharp-app

that ID should have and cache it for some period. All the same caveats apply though people can get round anything..

Protect .NET code from reverse engineering?

http://stackoverflow.com/questions/506282/protect-net-code-from-reverse-engineering

only prevents it from making it a walk in the park. All your hard work with your complex license code can be undone..

What is the difference between const and readonly?

http://stackoverflow.com/questions/55984/what-is-the-difference-between-const-and-readonly

is updated to 30 you only need to build AssemblyA. All clients do not need to be recompiled. So if you are confident..

Create Generic method constraining T to an Enum

http://stackoverflow.com/questions/79126/create-generic-method-constraining-t-to-an-enum

building a function to extend the Enum.Parse concept that Allows a default value to be parsed in case that an Enum value is.. forces the ugly boxing requirement to your code. EDIT All suggestions below have been greatly appreciated thanks. Have..

Using C#, how does one figure out what process locked a file?

http://stackoverflow.com/questions/860656/using-c-how-does-one-figure-out-what-process-locked-a-file

Win32API.OpenProcess Win32API.ProcessAccessFlags.All false process.Id var objBasic new Win32API.OBJECT_BASIC_INFORMATION.. return null IntPtr ipBasic Marshal.AllocHGlobal Marshal.SizeOf objBasic Win32API.NtQueryObject ipHandle.. Marshal.FreeHGlobal ipBasic IntPtr ipObjectType Marshal.AllocHGlobal objBasic.TypeInformationLength nLength objBasic.TypeInformationLength..

ExecuteReader requires an open and available Connection. The connection's current state is Connecting

http://stackoverflow.com/questions/9705637/executereader-requires-an-open-and-available-connection-the-connections-curren

all the more in the System.Data.SqlClient namespace. All the above speaks against a custom DB Class which encapsulates..

How do I serialize all properties of an NHibernate-mapped object?

http://stackoverflow.com/questions/1190718/how-do-i-serialize-all-properties-of-an-nhibernate-mapped-object

If you want all properties you have to load them ALL from the database for some an eager load will be enough for..

Parse JSON in C#

http://stackoverflow.com/questions/1212344/parse-json-in-c-sharp

Google AJAX Search API and print it out to the screen EDIT ALL FIXED All results are working fine. Thank you again Dreas Grech..

How do I use a Service Account to Access the Google Analytics API V3 with .NET C#?

http://stackoverflow.com/questions/12980215/how-do-i-use-a-service-account-to-access-the-google-analytics-api-v3-with-net-c

the appenders and set the default level root level value ALL appender ref ref RollingFileAppender appender ref ref TracePageAppender.. specific categories logger name DotNetOpenAuth level value ALL logger log4net dotNetOpenAuth This is an optional configuration..

Enum type constraints in C# [duplicate]

http://stackoverflow.com/questions/1331739/enum-type-constraints-in-c-sharp

requested feature. As I'm fond of pointing out ALL features are unimplemented until someone designs specs implements..

What is the best scripting language to embed in a C# desktop application? [closed]

http://stackoverflow.com/questions/137933/what-is-the-best-scripting-language-to-embed-in-a-c-sharp-desktop-application

class and the other uses. Just remember this will expose ALL public classes to the script options.ReferencedAssemblies.Add..

Why use simple properties instead of fields in C#? [duplicate]

http://stackoverflow.com/questions/2374416/why-use-simple-properties-instead-of-fields-in-c

Is it possible to get the parsed text of a SqlCommand with SqlParameters?

http://stackoverflow.com/questions/2789476/is-it-possible-to-get-the-parsed-text-of-a-sqlcommand-with-sqlparameters

similar WITH SomeTable SomeColumn AS SELECT N' ' UNION ALL SELECT N' o' UNION ALL SELECT N'^_^' SELECT SomeColumn FROM.. SomeColumn AS SELECT N' ' UNION ALL SELECT N' o' UNION ALL SELECT N'^_^' SELECT SomeColumn FROM SomeTable And the sample.. @ WITH SomeTable SomeColumn AS SELECT N' ' UNION ALL SELECT N' o' UNION ALL SELECT @Value SELECT SomeColumn FROM..

Select only items in a specific DIV using HtmlAgilityPack

http://stackoverflow.com/questions/2875347/select-only-items-in-a-specific-div-using-htmlagilitypack

'content' However when I use the code below I simply get ALL links on the entire page. This doesn't really make sense to..

Log4Net: Programmatically specify multiple loggers (with multiple file appenders)

http://stackoverflow.com/questions/308436/log4net-programmatically-specify-multiple-loggers-with-multiple-file-appenders

can then use the following calls SetLevel Log4net.MainForm ALL AddAppender Log4net.MainForm CreateFileAppender appenderName..

How to get ALL child controls of a Windows Forms form of a specific type (Button/Textbox)?

http://stackoverflow.com/questions/3419159/how-to-get-all-child-controls-of-a-windows-forms-form-of-a-specific-type-button

to get ALL child controls of a Windows Forms form of a specific type Button..

GetMethod for generic method [duplicate]

http://stackoverflow.com/questions/4035719/getmethod-for-generic-method

will return only methods with a matching name instead of ALL methods in the type. As a final nit pick the name GetGenericMethod..

Deploy C# ActiveX in a CAB for Internet Explorer use

http://stackoverflow.com/questions/5484326/deploy-c-sharp-activex-in-a-cab-for-internet-explorer-use

IE6 on XP. When I install ActiveX using MSI all is fine on ALL Windows. Apparently CAB thing is not working and I could not.. Downloading C# ActiveX Components through CAB file MSDN ALLUSERS Property Windows MSDN Non Admin ActiveX Controls MSDN Microsoft..

Count total rows of gridview with pagination

http://stackoverflow.com/questions/5788329/count-total-rows-of-gridview-with-pagination

else notifyLbl.Visible true notifyLbl.Text ALL VACANCIES ARE CLOSED IN deptList.SelectedItem.Text.ToUpper .. true else notifyLbl.Visible true notifyLbl.Text ALL VACANCIES ARE CLOSED IN deptList.SelectedItem.Text.ToUpper ..

Fastest Way of Inserting in Entity Framework

http://stackoverflow.com/questions/5940225/fastest-way-of-inserting-in-entity-framework

likely improve the performance Call SaveChanges once after ALL records. Call SaveChanges after for example 100 records. Call..

How to catch ALL exceptions/crashes in a .NET app [duplicate]

http://stackoverflow.com/questions/82483/how-to-catch-all-exceptions-crashes-in-a-net-app

to catch ALL exceptions crashes in a .NET app duplicate Possible Duplicate..