¡@

Home 

c# Programming Glossary: it's

String vs string in C# [duplicate]

http://stackoverflow.com/questions/215255/string-vs-string-in-c-sharp

like int vs. System.Int32 . As far as guidelines I think it's generally recommended to use string any time you're referring.. to an object. e.g. string place world Likewise I think it's generally recommended to use String if you need to refer specifically..

Randomize a List<T> in C#

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

course right. There's nothing wrong with System.Random if it's used in the way it was intended. In my first example above I..

Casting vs using the 'as' keyword in the CLR

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

time of starting this answer have really explained where it's worth using which. Don't do this Bad code checks type twice.. really should be an instance of TargetType i.e. if it's not that means there's a bug then casting is the right solution... currently this is actually slower than is cast . I think it's more elegant and consistent but there we go. If you really don't..

Proper use of the IDisposable interface

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

resource If you found it in the Microsoft .NET Framework it's managed. If you went poking around MSDN yourself it's unmanaged... it's managed. If you went poking around MSDN yourself it's unmanaged. Anything you've used P Invoke calls to get outside.. calling it from Dispose as opposed to Finalize meaning it's safe to free managed resources. This internal method could be..

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

to use when For values which are naturally exact decimals it's good to use decimal. This is usually suitable for any concepts.. values won't be decimally accurate to start with so it's not important for the expected results to maintain the decimal..

Difference between Property and Field in C# 3.0+

http://stackoverflow.com/questions/653536/difference-between-property-and-field-in-c-sharp-3-0

ignore the other suggestions here the other reason is that it's simply not good OO design. And if you don't have a very good..

What's the difference between String and string?

http://stackoverflow.com/questions/7074/whats-the-difference-between-string-and-string

like int vs. System.Int32 . As far as guidelines I think it's generally recommended to use string any time you're referring.. to an object. e.g. string place world Likewise I think it's generally recommended to use String if you need to refer specifically..

Deep cloning objects in C#

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

object. I don't often need this functionality so when it's been necessary I've resorted to creating a new object and then..

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

running fast it will try to access the file before it's been saved back to the filesystem and throw an error File in..

decimal vs double! - Which one should I use and when? [duplicate]

http://stackoverflow.com/questions/1165761/decimal-vs-double-which-one-should-i-use-and-when

share improve this question For money always decimal. It's why it was created. If numbers must add up correctly or balance..

Should Usings be inside or outside the namespace

http://stackoverflow.com/questions/125319/should-usings-be-inside-or-outside-the-namespace

and it affects the maintainability of your code. It's also interesting to note what happens if Foo is in namespace..

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

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

this question You can use a library called ExcelLibrary. It's a free open source library posted on Google Code ExcelLibrary.. yet but they are working on adding that functionality in. It's very simple small and easy to use. Plus it has a DataSetHelper..

What are the pros and cons to keeping SQL in Stored Procs versus Code

http://stackoverflow.com/questions/15142/what-are-the-pros-and-cons-to-keeping-sql-in-stored-procs-versus-code

Agreed which is why storedprocs are a bad thing. It's much easier to refactor and decompose break into smaller parts..

Simple 2 way encryption for C#

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

simple encrypt and decrypt functionality for some data. It's not mission critical. I need something to keep honest people..

TransactionScope automatically escalating to MSDTC on some machines?

http://stackoverflow.com/questions/1690892/transactionscope-automatically-escalating-to-msdtc-on-some-machines

they get the MSDTC on SERVER is unavailable error message. It's really got me scratching my head and has me seriously considering.. like solution based on ADO.NET transaction objects. It's seemingly insane the same code that works and does not escalate..

String vs string in C# [duplicate]

http://stackoverflow.com/questions/215255/string-vs-string-in-c-sharp

for System.String . So technically there is no difference. It's like int vs. System.Int32 . As far as guidelines I think it's..

Creating application shortcut in a directory

http://stackoverflow.com/questions/234231/creating-application-shortcut-in-a-directory

c# .net file io shortcut share improve this question It's not as simple as I'd have liked but there is a great class call..

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

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

and how they can be avoided before even running into them. It's not even necessarily about plug and play code that anyone should..

Why does one often see “null != variable” instead of “variable != null” in C#?

http://stackoverflow.com/questions/271561/why-does-one-often-see-null-variable-instead-of-variable-null-in-c

first one c# coding style share improve this question It's a hold over from C. In C if you either use a bad compiler or..

Randomize a List<T> in C#

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

criticised System.Random method to select swap candidates. It's fast but not as random as it should be. If you need a better..

Validate a username and password against Active Directory?

http://stackoverflow.com/questions/290548/validate-a-username-and-password-against-active-directory

bool isValid pc.ValidateCredentials myuser mypassword It's simple it's reliable it's 100 C# managed code on your end what..

Splash Screen waiting until thread finishes

http://stackoverflow.com/questions/392864/splash-screen-waiting-until-thread-finishes

a second application the splash screen form turns white... It's most likely due to the fact that splash screen is busy executing..

Is there any significant difference between using if/else and switch-case in C#?

http://stackoverflow.com/questions/395618/is-there-any-significant-difference-between-using-if-else-and-switch-case-in-c

on string constants and this works a bit differently. It's obviously not practical to build jump tables for strings of..

Casting vs using the 'as' keyword in the CLR

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

if randomObject is a field rather than a local variable. It's possible for the if to pass but then the cast to fail if another..

Sending email through Gmail SMTP server with C#

http://stackoverflow.com/questions/704636/sending-email-through-gmail-smtp-server-with-c-sharp

projects to create an EmailSender project at Codeplex . It's designed for testability and supports my favourite SMTP services..

What's the difference between String and string?

http://stackoverflow.com/questions/7074/whats-the-difference-between-string-and-string

for System.String . So technically there is no difference. It's like int vs. System.Int32 . As far as guidelines I think it's..

C# Events and Thread Safety

http://stackoverflow.com/questions/786383/c-sharp-events-and-thread-safety

the invocation list for that delegate has 1000 entries. It's perfectly possible that the action at the start of the list..