Eg Net Solution: C# Snippet

Here in this sites web and software developer can get some essential information.

MY Favorite .Net Question For Interview

This are not tidy. Just for rough. In Sha Allah will make it tiddy soon. 1.  DateTime2 Date range 0001-01-01 through 9999-12-31  vs Date...

Users Countries


Showing posts with label C# Snippet. Show all posts
Showing posts with label C# Snippet. Show all posts

Thursday, October 18, 2018

Programming Or Algorithms Snippet

October 18, 2018 0
Programming Or Algorithms Snippet
1. Swap value of 2 variable with out using any third variable.
Suppose

  1.  a= 5
  2.  b = 7
  3.  a = a + b;  = 12;
  4.  b =  a - b ;  =  5;
  5.  a = a -b; = 7

 You can also swap two equal length array with out using any temporary third variable by looping and traversing the arrays. 

Tuesday, October 9, 2018

C# Snippet

October 09, 2018 0
C# Snippet

1. Formatting Date-time:  string.Format("{0:dd/MM/yy}", DateTime.Today)
2. Storing List Data in ViewBag and retrieve the List Data in View Or Getting List Data From ViewBag :

3. If you want to pass multiple different list in a View from ASP .Net MVC Controller Action How can you pass it?
Answer: 
In Action:  ViewBag.MyClassList = new List<MyClass>() ;
 List<MyClass> MyClassList = ViewBag.MyClassList as List<MyClass>;

Returning JSON Data From Server To Client :: 
  1.  var data = obj_dal.LoadAllProductCode(TKTCode, "1", allMenu.User.USER_ID.ToString());    
  2.             var MaxJson = Json(new { ListProductCode = data});
  3.             MaxJson.MaxJsonLength = 999999999;
  4.             return MaxJson;
Or
  1. var MaxJson =   Json(new { ListOrderBooking = obj_dal.LoadOrderBookingDL(OrderNo, allMenu.User.EMPLOYEE_ID.ToString()) });
  2. MaxJson.MaxJsonLength = 999999999;
  3. return MaxJson;

Add Choice