Friday, 28 October 2011

ArcFM Snippet #1 - To get Current Session ID and Current Session's Version


IMMPxApplication mmPxApplication = IApplication as IMMPxApplication;
IMMSessionManager2 ObjMSessionManager = mmPxApplication.FindPxExtensionByName
                    ("MMSessionManager") as IMMSessionManager2;

// If you this is a subtask you would get the node Id as a parameted in IMMPxSubtas.Execute Method.
int currentNodeId = currentNode.Id; bool blnBoolean = true;

// Acquiring the current session and session id
                ObjMSession = ObjMSessionManager.GetSession(ref intNodeId, ref blnBoolean);

//Getting the current session’s version
IMMPxApplicationEx2 ObjPxAppEx= IMMPxApplication as IMMPxApplicationEx2;
IMMPxSDEVersion ObjPxSDEVersion = ObjPxAppEx.GetSDEVersion(pPxNode.Id, pPxNode.NodeType, true);

about using VAR in your programming


  • var can only be used when a local variable is declared and initialized in the same statement; the variable cannot be initialized to null, or to a method group or an anonymous function.
  • var cannot be used on fields at class scope.
  • Variables declared by using var cannot be used in the initialization expression. In other words, this expression is legal: int i = (i = 20); but this expression produces a compile-time error: var i = (i = 20);
  • Multiple implicitly-typed variables cannot be initialized in the same statement.
  • If a type named var is in scope, then the var keyword will resolve to that type name and will not be treated as part of an implicitly typed local variable declaration.
You may find that var can also be useful with query expressions in which the exact constructed type of the query variable is difficult to determine. This can occur with grouping and ordering operations.
The var keyword can also be useful when the specific type of the variable is tedious to type on the keyboard, or is obvious, or does not add to the readability of the code. One example where var is helpful in this manner is with nested generic types such as those used with group operations. In the following query, the type of the query variable isIEnumerable<IGrouping<string, Student>>. As long as you and others who must maintain your code understand this, there is no problem with using implicit typing for convenience and brevity.

Finally.....


However, the use of var does have at least the potential to make your code more difficult to understand for other developers. For that reason, the C# documentation generally uses var only when it is required ! ! !

Friday, 21 October 2011

Blogging first time :)

My first day of blogging, much interesting!!! I wish to make this blog a good place to share technology, ideas, knowledge, thoughts, fun, smile etc. In fact blogging was my long time wish and finally today I believe I made it true. I have many good friends who always share knowledge, with them in circle I have started this blog believing them would keep my blogging going on for ever. My hearty thanks to everyone!!! keep blogging, cheers .