Posts

Showing posts from August, 2010

Using Read-only versus const

There are Two difference versions of constants in C#: the Const keyword is used for compile –time constants read only keyword is used for runtime constants. The main issue with const is that it's evaluated at compile-time, which means if it's changed at a later date; you have to not only recompile that application, but all applications that reference that application. In contrast, read -only is evaluated at run-time providing you a lot more flexibility. An overview of differences between const and read-only in c#      Const Read only Cont be static Can be either instance-level or static Value is evaluated at compile time The value is evaluated at run time. It is initialized at declaration only It can be initialized in declaration or by code in the code constructor .therefore read only fields have difference values depending on constructor used.   So, const should really only be used for logical, real-world constants such as days of week, numeric Constants, etc. as for as perfo

Setting Required Field Mark on demand in MS CRM 4.0

In one of our projects we came across the requirement to set required field mark based on change in pick list. To full fill the requirement I find a JavaScript method supports in MS CRM 4.0. Syntax: crmForm.SetFieldReqLevel(" field name ", value );     Fields Name is name of the field which you want place as required.     Value represents is this field marked as required or not.      1 for required field mark      0 for not required field mark Example for required field mark : crmForm.SetFieldReqLevel("pos_datetimeoftxn", 1); Example for not required field mark : crmForm.SetFieldReqLevel("pos_datetimeoftxn", 0);