Search Results

Search found 2 results on 1 pages for '4eburek'.

Page 1/1 | 1 

  • C# huge size 2-dim arrays

    - by 4eburek
    I need to declare square matrices in C# WinForms with more than 20000 items in a row. I read about 2GB .Net object size limit in 32bit and also the same case in 64bit OS. So as I understood the single answer - is using unsafe code or separate library built withing C++ compiler. The problem for me is worth because ushort[20000,20000] is smaller then 2GB but actually I cannot allocate even 700MB of memory. My limit is 650MB and I don't understand why - I have 32bit WinXP with 3GB of memory. I tried to use Marshal.AllocHGlobal(700<<20) but it throws OutOfMemoryException, GC.GetTotalMemory returns 4.5MB before trying to allocate memory. I found only that many people say use unsafe code but I cannot find example of how to declare 2-dim array in heap (any stack can't keep so huge amount of data) and how to work with it using pointers. Is it pure C++ code inside of unsafe{} brackets? Could you please provide a small example of working with matrices using pointers in unsafe code.

    Read the article

  • How to convert model into url properly in asp.net MVC?

    - by 4eburek
    From the SEO standpoint it is nice to see urls in format which explains what is located on a page Let's have a look on such situation (it is just example) We need to display page about some user and decided to have such url template for that page: /user/{UserId}/{UserCountry}/{UserLogin}. And create for this purpose such model public class UserUrlInfo{ public int UserId{get;set;} public string UserCountry{get;set;} public string UserLogin{get;set;} } I want to create controller method where I pass UserUrlInfo object but not all required fields. Classic controller method for url template shown above is following public ActionResult Index(int UserId, string UserCountry, string UserLogin){ return View(); } and we need to call it like that Html.ActionLink<UserController>(x=>Index(user.UserId, user.UserCountry, user.UserLogin), "See user page") I want to create such controller method public ActionResult Index(UserUrlInfo userInfo){ return View(); } and call it like that: Html.ActionLink<UserController>(x=>Index(user), "See user page") Actually I works when we add one more route and point it to the same controller method, so routing will be: /user/{userInfo} /user/{UserId}/{UserCountry}/{UserLogin} In this situation routing engine gets string method of our model (need to override it) and it works ALMOST always. But sometimes it fails and show url like /page/?userInfo=/US/John So my workaround does not always work properly. Does anybody know how to work with urls in such way?

    Read the article

1