c# Programming Glossary: null
How to properly clean up Excel interop objects http://stackoverflow.com/questions/158706/how-to-properly-clean-up-excel-interop-objects excelSheet 0 excelSheet null GC.Collect GC.WaitForPendingFinalizers Although this kind of..
Encrypt/Decrypt string in .NET http://stackoverflow.com/questions/202011/encrypt-decrypt-string-in-net throw new ArgumentNullException sharedSecret string outStr null Encrypted string to return RijndaelManaged aesAlg null RijndaelManaged.. null Encrypted string to return RijndaelManaged aesAlg null RijndaelManaged object used to encrypt the data. try generate.. finally Clear the RijndaelManaged object. if aesAlg null aesAlg.Clear Return the encrypted bytes from the memory stream...
Deserialize JSON into C# dynamic object? http://stackoverflow.com/questions/3142495/deserialize-json-into-c-sharp-dynamic-object Type type JavaScriptSerializer serializer if dictionary null throw new ArgumentNullException dictionary return type typeof.. return type typeof object new DynamicJsonObject dictionary null public override IDictionary string object Serialize object obj.. IDictionary string object dictionary if dictionary null throw new ArgumentNullException dictionary _dictionary dictionary..
Dynamic LINQ OrderBy on IEnumerable<T> http://stackoverflow.com/questions/41244/dynamic-linq-orderby-on-ienumerablet .Length 2 .MakeGenericMethod typeof T type .Invoke null new object source lambda return IOrderedQueryable T result .. Func CallSite object object callSites name if callSite null callSites name callSite CallSite Func CallSite object object.. CSharpArgumentInfo.Create CSharpArgumentInfoFlags.None null return callSite internal static Func dynamic object GetAccessor..
Deep cloning objects in C# http://stackoverflow.com/questions/78536/deep-cloning-objects-in-c-sharp The type must be serializable. source Don't serialize a null object simply return the default for that object if Object.ReferenceEquals.. default for that object if Object.ReferenceEquals source null return default T IFormatter formatter new BinaryFormatter..
How to use HTML Agility pack http://stackoverflow.com/questions/846994/how-to-use-html-agility-pack any errors from the Load statement if htmlDoc.ParseErrors null htmlDoc.ParseErrors.Count 0 Handle any parse errors as required.. any parse errors as required else if htmlDoc.DocumentNode null HtmlAgilityPack.HtmlNode bodyNode htmlDoc.DocumentNode.SelectSingleNode.. htmlDoc.DocumentNode.SelectSingleNode body if bodyNode null Do something with bodyNode NB This code is an example only..
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 virtual bool IsFileLocked FileInfo file FileStream stream null try stream file.Open FileMode.Open FileAccess.ReadWrite FileShare.None.. has already been processed return true finally if stream null stream.Close file is not locked return false Edit Please check..
(C#) How to check if System.Net.WebClient.DownloadData is downloading a binary file? http://stackoverflow.com/questions/153451/c-how-to-check-if-system-net-webclient-downloaddata-is-downloading-a-binary-f I checked the WebResponse.contenttype it always return me NULL. Anyone have any idea what could be the cause c# file download..
Parsing CSV files in C# http://stackoverflow.com/questions/2081418/parsing-csv-files-in-c-sharp out attributes like default values replacements for NULL values and so forth point the FileHelpers engine at a file and..
What is a message pump? http://stackoverflow.com/questions/2222365/what-is-a-message-pump It roughly looks like this MSG msg while GetMessage msg NULL 0 0 TranslateMessage msg DispatchMessage msg The GetMessage..
Accessing Password Protected Network Drives in Windows in C#? http://stackoverflow.com/questions/2563724/accessing-password-protected-network-drives-in-windows-in-c The default security provider is negotiate unless you pass NULL for the domain name and the user name is not in UPN format...
What is managed/unmanaged code in C#? http://stackoverflow.com/questions/334326/what-is-managed-unmanaged-code-in-c It runs fine but when I try it in NUnit it returns NULL . In the MSDN it states that it can return NULL when called.. it returns NULL . In the MSDN it states that it can return NULL when called from unmanaged code. What is managed or unmanaged..
LINQ to SQL using GROUP BY and COUNT(DISTINCT) http://stackoverflow.com/questions/448203/linq-to-sql-using-group-by-and-countdistinct t2 . City FROM dbo . Customers AS t2 WHERE t1 . Country IS NULL AND t2 . Country IS NULL OR t1 . Country IS NOT NULL AND t2.. AS t2 WHERE t1 . Country IS NULL AND t2 . Country IS NULL OR t1 . Country IS NOT NULL AND t2 . Country IS NOT NULL AND.. IS NULL AND t2 . Country IS NULL OR t1 . Country IS NOT NULL AND t2 . Country IS NOT NULL AND t1 . Country t2 . Country AND..
How to return text from Native (C++) code http://stackoverflow.com/questions/5308584/how-to-return-text-from-native-c-code like this BSTR ANSItoBSTR const char input BSTR result NULL int lenA lstrlenA input int lenW MultiByteToWideChar CP_ACP.. input int lenW MultiByteToWideChar CP_ACP 0 input lenA NULL 0 if lenW 0 result SysAllocStringLen 0 lenW MultiByteToWideChar..
NTFS Alternate Data Streams - .NET http://stackoverflow.com/questions/604960/ntfs-alternate-data-streams-net CreateFile testfile GENERIC_WRITE FILE_SHARE_WRITE NULL OPEN_ALWAYS 0 NULL if hFile INVALID_HANDLE_VALUE printf.. GENERIC_WRITE FILE_SHARE_WRITE NULL OPEN_ALWAYS 0 NULL if hFile INVALID_HANDLE_VALUE printf Cannot open testfile n.. testfile n else WriteFile hFile This is testfile 16 dwRet NULL hStream CreateFile testfile stream GENERIC_WRITE FILE_SHARE_WRITE..
Conditional operator assignment with Nullable<value> types? http://stackoverflow.com/questions/75746/conditional-operator-assignment-with-nullablevalue-types on a LINQ to SQL dbml object where the column allows NULL values . Unfortunately the compiler feels that There is no implicit..
WCF - Design Parameter Decision http://stackoverflow.com/questions/9553267/wcf-design-parameter-decision for validating that the list of renewals returned is NULL Where this validation should happen inside service operation.. for validating that the list of renewals returned is NULL. More importantly that the list being NULL means that there.. returned is NULL. More importantly that the list being NULL means that there are no contract renewals in progress. The UpdateFundApprovalDate..
Possible pitfalls of using this (extension method based) shorthand http://stackoverflow.com/questions/123088/possible-pitfalls-of-using-this-extension-method-based-shorthand for directly null types int i SomeFunctionWhichMightReturnNull propertyValue2 i 0 So I came up with the following public static.. So I came up with the following public static TResult IfNotNull T TResult this T input Func T TResult action TResult valueIfNull.. TResult this T input Func T TResult action TResult valueIfNull where T class if input null return action input else return..
C#, FindControl http://stackoverflow.com/questions/1457567/c-findcontrol why this doesn't work. After compile I receive a Null reference exception . Please help. public partial class labs_test..
How to bind to a PasswordBox in MVVM http://stackoverflow.com/questions/1483892/how-to-bind-to-a-passwordbox-in-mvvm Username contains data from my View but Password is Null Empty private DelegateCommand loginCommand public string Username.. loginCommand private bool CanLogin return string.IsNullOrEmpty Username private void Login bool result securityService.IsValidLogin..
Overhead of a .NET array? http://stackoverflow.com/questions/1589669/overhead-of-a-net-array comment Type pointer Size of array Element type pointer Null reference first element For z the values are Sync block Type..
Can I specify my explicit type comparator inline? http://stackoverflow.com/questions/188120/can-i-specify-my-explicit-type-comparator-inline TKey comparer if projection null throw new ArgumentNullException projection this.comparer comparer EqualityComparer.. then using the equality comparer on the resulting keys. Null references are never passed to the projection. summary public.. GetHashCode TSource obj if obj null throw new ArgumentNullException obj return comparer.GetHashCode projection obj And..
avoiding null reference exceptions http://stackoverflow.com/questions/1943465/avoiding-null-reference-exceptions do something like this if customer null throw new ArgumentNullException customer Now I recommend Contract.Requires customer.. 2004 LNCS vol. 3362 Springer 2004 they wrote 1.0 Non Null Types Many errors in modern programs manifest themselves as..
Deep Null checking, is there a better way? http://stackoverflow.com/questions/2080647/deep-null-checking-is-there-a-better-way Null checking is there a better way We've all been there we have..
How can a separator be added between items in an ItemsControl http://stackoverflow.com/questions/2511227/how-can-a-separator-be-added-between-items-in-an-itemscontrol Binding RelativeSource RelativeSource PreviousData Value x Null Setter Property Visibility TargetName commaTextBlock Value..
Default string initialization: NULL or Empty? [closed] http://stackoverflow.com/questions/265875/default-string-initialization-null-or-empty or œâ€ What is the difference between String.Empty and œâ€ a Null or empty string to represent no data in table column c# ..
Setting Objects to Null/Nothing after use in .NET http://stackoverflow.com/questions/2785/setting-objects-to-null-nothing-after-use-in-net Objects to Null Nothing after use in .NET Should you set all the objects to..
Shortcut for “null if object is null, or object.member if object is not null” [duplicate] http://stackoverflow.com/questions/3817930/shortcut-for-null-if-object-is-null-or-object-member-if-object-is-not-null deep lambda expression duplicate 10 answers Deep Null checking is there a better way 15 answers I'm trying.. that let's me do this this.startDate startDateXAttribute.NullOrPropertyOf DateTime return DateTime.Parse startDateXAttribute.Value.. DateTime return DateTime.Parse startDateXAttribute.Value NullOrPropertyOf would return null if it's used on a null object..
C#: How to access an Excel cell? http://stackoverflow.com/questions/472959/c-how-to-access-an-excel-cell FALL rs3.Fields 1 .Value j objsheet.Cells i j .Value Null Value j objsheet.Cells i j .Value Updated with 888 These are..
Null or default comparison of generic argument in C# http://stackoverflow.com/questions/65351/null-or-default-comparison-of-generic-argument-in-c-sharp or default comparison of generic argument in C# I have a generic..
Conditional operator assignment with Nullable<value> types? http://stackoverflow.com/questions/75746/conditional-operator-assignment-with-nullablevalue-types operator assignment with Nullable value types EmployeeNumber string.IsNullOrEmpty employeeNumberTextBox.Text.. with Nullable value types EmployeeNumber string.IsNullOrEmpty employeeNumberTextBox.Text null Convert.ToInt32 employeeNumberTextBox.Text.. myself wanting to do things like this EmployeeNumber is a Nullable int as it's a property on a LINQ to SQL dbml object where..
?? Null Coalescing Operator --> What does coalescing mean? http://stackoverflow.com/questions/770186/null-coalescing-operator-what-does-coalescing-mean Null Coalescing Operator What does coalescing mean I'm tempted to.. the word and I understand it to be a synonym for 'join'. 'Null Join Operator' still doesn't make sense. Can someone enlighten..
WPF C# InputBox http://stackoverflow.com/questions/8103743/wpf-c-sharp-inputbox Button x Name YesButton Margin 5 Content Yes Background x Null Click YesButton_Click Button x Name NoButton Margin 5 Content.. Button x Name NoButton Margin 5 Content No Background x Null Click NoButton_Click StackPanel StackPanel Border Grid Grid..
What is the “??” operator for? [duplicate] http://stackoverflow.com/questions/827454/what-is-the-operator-for can i use it what about int is it nullable int See also Null Coalescing Operator What does coalescing mean c# operators..
How to use LINQ to select object with minimum or maximum property value http://stackoverflow.com/questions/914109/how-to-use-linq-to-select-object-with-minimum-or-maximum-property-value or maximum property value I have a Person object with a Nullable DateOfBirth property. Is there a way to use LINQ to query.. p p.DateOfBirth.GetValueOrDefault DateTime.MaxValue Null DateOfBirth values are set to DateTime.MaxValue in order to..
ReSharper - Possible Null Assignment when using Microsoft.Contracts http://stackoverflow.com/questions/929859/resharper-possible-null-assignment-when-using-microsoft-contracts Possible Null Assignment when using Microsoft.Contracts Is there any way.. Possible 'null' assignment to entity marked with 'NotNull' attribute in ReSharper on lines 7 and 8 private Dictionary.. string public void Foo string s Contract.Requires String.IsNullOrEmpty s if _Lookup.ContainsKey s _Lookup.Remove s What is really..
|