DCSIMG
C#,.Net Framework - Gil Fink's Blog

Gil Fink's Blog

Fink about IT

News

Microsoft MVP

My Facebook Profile My Twitter Profile My Linkedin Profile

Locations of visitors to this page

Creative Commons License

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
© Copyright 2013 Gil Fink

Hebrew Articles

Index Pages

My OSS Projects

English Articles

Browse by Tags

All Tags » C# » .Net Framework (RSS)
Back to Basics – Null-Coalescing Operator
Back to Basics – Null-Coalescing Operator Yesterday during an EF4 course that I’m giving at a customer I showed an example for a property that is set using the null-coalescing operator . Since some of the students asked me what is this operator, I gave a small explanation and thought that it’s something that I can share here in the blog. So here it goes… Null-Coalescing Operator The null-coalescing operator or ?? can be very useful when you want to check nullity of a reference type or nullable types...
Book Review – C# in Depth – What You Need to Master C# 2 and 3
Book Review – C# in Depth – What You Need to Master C# 2 and 3 In the last weeks I read the book “ C# in Depth – What You Need to Master C# 2 and 3 ” that was written by Jon Skeet . You might ask yourself why I bothered reading a book about C# 2 and 3. The answer is very simple. Knowing some material isn’t enough and reading leads to wide and deeper knowledge. One of the first things that I recommend people who ask me how can I learn and gain programming knowledge is reading good technical books...
Performing Queries Against Active Directory Domain Services
Performing Queries Against Active Directory Domain Services One of the missions that needed my attention lately was to check whether a user exists in an enterprise Active Directory . The post will show exactly how to perform such a query. The DirectoryEntry Class The DirectoryEntry class represent an entry in Active Directory . That entry live in memory when created and changes that you perform on it won’t be submitted to Active Directory unless you call the CommitChnages method. That class can be...
Quick Tip – Making Beep From the PC Speaker Using P/Invoke
Quick Tip – Making Beep From the PC Speaker Using P/Invoke I was asked yesterday how can we perform a beep sound from the PC speaker. This is  something that is needed in one of the  applications that I’m consulting for to indicate a successful transaction (don’t ask me way…).  Setting the Environment We first need to add the using for Runtime.InteropServices : using System.Runtime.InteropServices; Then load the unmanaged dll of kernel32.dll with the method signature for Beep which...
Quick Tip – Using the ShouldSerializeXXX methods
Quick Tip – Using the ShouldSerializeXXX methods Something that I encountered last week. The ShouldSerialize methods are optional methods that you can provide for a class property. These methods are built as ShouldSerialize PropertyName and inside of them you can provide a check that will determine whether the property should be serialized or not. Of course this can be achieved only in serializable classes. An example of use: public string Text { get; set; }   public bool ShouldSerializeText...
Back to Basics – Calculating MD5 Hashing
Back to Basics – Calculating MD5 Hashing Yesterday I needed to use a hashing algorithm for a given task. I chose to use the MD5   hashing algorithm and in this post I’ll show how to calculate MD5 hash from a given string. What is MD5 Hashing Algorithm? MD5 is a very widely used hashing function that commonly used to check the integrity of files or strings. When using MD5 There is a small possibility of getting two identical hashes to two different strings. It is very useful for storing passwords...
Back to Basics – Zip in .NET
Back to Basics – Zip in .NET In today’s post I’m going to share a problem I solved this week. The solution was to use the framework’s System.IO.Compression namespace and the GZipStream object. The Problem In my current project we save Xml data in our database. The field to save the data was of type varchar(6000). This way of saving the data raised a problem of big Xml data (over 8000 kb for every Xml data) which were saved in the database and for the long run could raise space and performance problems...
Back to Basics – How to Retrieve a Value Returned by a SP
Back to Basics – How to Retrieve a Value Returned by a SP In the following posts I’m going to describe basic tools which every developer needs to know. In today’s post I’m going to explain how to retrieve a value returned by a stored procedure . The Story Behind the Post During this week one of my colleagues asked me if it’s possible get a returned value of a stored procedure with the infrastructure I wrote to my current project. The question regarded a returning value and not output parameters which...
Back to Basics – The Default Keyword in Generic Code
Back to Basics – The Default Keyword in Generic Code In the following posts I’m going to describe basic tools which every developer needs to know. In today’s post I’m going to explain what is the default keyword in generic code and how to use it. What is the Default Keyword? The default keyword has dual meaning since .Net framework 2.0 was published. The first meaning is inside the switch construct to inform the switch that if non of the cases is valid then the switch will go to the default block...
Invoking Generic Methods With Reflection
Invoking Generic Methods With Reflection A few days ago I answered a question in the ASP.NET forums concerning the issue of invoking generic methods with reflection . In this post I’m going to explain that issue. If generics or reflection are new to you you can read about them in the next MSDN links: Overview of Generics in the .NET Framework Reflection Overview Getting started You will need to create a new console application in order to make the example work. In the following examples I’m going...
Back to Basics – Nullable Value Type
Back to Basics – Nullable Value Type In the following posts I’m going to describe basic tools which every developer needs to know. In today’s post I’m going to explain what is a Nullable value type and how to use it in your code. What are Nullable Value Types? Nullable value types are an instances of the Nullable<T> struct. The nullable value type can hold the all the values that its underlining value type holds and a null value. The main reason for this type came from the use of databases...
Back to Basics – Cloning
Back to Basics – Cloning In the following posts I’m going to describe basic tools which every developer needs to know. In today’s post I’m going to explain what is cloning and how to implement cloning in your application. What is Cloning? Cloning is the ability to make an exact copy of an instance of a type. There are two known forms of cloning : Shallow copy – all the fields of the original object are being copied to the copied object and the two objects reference the same objects in the end of...
Improving Performance By Using ASP.NET Caching - Output Cache
Improving Performance By Using ASP.NET Caching - Output Cache What is ASP.NET caching mechanism? When to use caching ? and how can I use it in order to improve my site performance ? are the questions this post series is going to answer. In today’s post I’ll introduce the output cache . You can read the previous posts in the subject: Improving performance by using ASP.NET caching Improving performance by using ASP.NET caching – application caching What is Output Cache ? Output cache is a mechanism...
Building a .Net Client for ADO.NET Data Service
Building a .Net Client for ADO.NET Data Service In the previous post about ADO.NET data services I introduced the data services topic and showed a simple example of how to build a data service . In today’s post I’m going to explain how to consume the built data service by a .NET client . Revisiting The Previous Post Example In the previous post I gave an example of course class and course data context. In the previous example I used the preview version of ADO.NET data service and since then the VS2008...
Improving Performance By Using ASP.NET Caching - Application Caching
In the post I describe the application cache mechanism and how to use it....
More Posts Next page »