Search:

Type: Posts; User: KIBO

Page 1 of 14 1 2 3 4

Search: Search took 0.01 seconds.

  1. Thread: string.Trim

    by KIBO
    Replies
    2
    Views
    1,910

    nvm, the following code prints true for s1 =...

    nvm, the following code prints true for s1 = "test" and false for "test "


    string s1 = "test";
    string s2 = s1.Trim();

    Console.WriteLine(object.ReferenceEquals(s1, s2));
  2. Thread: string.Trim

    by KIBO
    Replies
    2
    Views
    1,910

    string.Trim

    strings are immutable classes, fine

    but consider the Trim function. What happens when Trim finds out theres nothing to trim. Will it do just "return this" or "return new string(this)"
    ??
  3. Replies
    2
    Views
    2,511

    Got working with AppDomain.DoCallback which...

    Got working with AppDomain.DoCallback which executes the code in the new AppDomain and doesnt load the assembly in the main AppDomain



    AppDomainSetup setup = new AppDomainSetup();...
  4. Replies
    2
    Views
    2,511

    loading assemble into AppDomain

    I used to have this code which loads an assembly:



    Assembly assembly = Assembly.LoadFrom(assemblyName);


    It works fine but now I need to load it into a separate AppDomain.
  5. Thread: Action object

    by KIBO
    Replies
    2
    Views
    1,423

    Action object

    consider this code:


    private void DoIf(bool b, Action f)
    {
    if (b)
    f();
    }

    int x = 0;
  6. Replies
    6
    Views
    6,718

    Or check what Environment.CurrentDirectory...

    Or check what Environment.CurrentDirectory returns and use a relative path to your dll. Thats a bit safer and a little more freedom to move your app around
  7. Replies
    3
    Views
    2,239

    agree on the naming part (except that default...

    agree on the naming part (except that default cant be used, its a keyword)

    disagree on the not catching exceptions part. Convert.ToBoolean throws an exception too if it cant be formatted so...
  8. Replies
    3
    Views
    2,239

    I love extension methods

    No question in this post, just something you might put to good use too:

    I got sick of this code that uses Configurationmanager all over the place


    bool b;
    string s =...
  9. Replies
    5
    Views
    1,654

    GetOverlappedResult helped indeed, there were...

    GetOverlappedResult helped indeed, there were still bytes pending to be written. Thanks!

    So the correct order of closing a serial port would be:

    GetOverlappedResult(hPort, ptrUWO, out sent,...
  10. Replies
    5
    Views
    1,654

    It's an access violation, not a .NET exception

    It's an access violation, not a .NET exception
  11. Replies
    5
    Views
    1,654

    crash after upgrade

    Consider the following code which closes an overlapped I/O serial handle during application shutdown.



    Win32Com.CancelIo(hPort);

    Win32Com.CloseHandle(hPort);


    It works fine...
  12. Replies
    3
    Views
    1,319

    thanks people, I found out that ildasm is still...

    thanks people, I found out that ildasm is still in the SDK that was good enough. I needed to see if a certain function was in a deployed assembly to rule out if that was why my code was crashing....
  13. Replies
    3
    Views
    1,319

    tool for checking functions in assembly?

    is there a tool to find all functions and classes in an assembly?
  14. Thread: AsParallel

    by KIBO
    Replies
    2
    Views
    2,432

    AsParallel

    Whats the advantage of using AsParallel on an array opposed to just using the array directly?



    al.ToArray().AsParallel().ForAll(po => CacheToAppFabric((MyObject)po));
  15. difference when starting a program from network?

    the following code prevents windows from letting the monitor go into sleep mode when the program is active and wakes the monitor up after a scanner scans something.



    protected override...
  16. Replies
    2
    Views
    1,671

    I see, thanks

    I see, thanks
  17. Replies
    2
    Views
    1,671

    yield and Dispose()

    Consider this code:



    class Test : IDisposable
    {
    public void Dispose()
    {
    Console.WriteLine("dispose");
    }
  18. Replies
    1
    Views
    1,463

    using SqlTransaction when reading database

    Is it useful to use SqlTransaction and transaction.commit() or rollback when only reading from a database? Have some code here that does that
  19. Thread: unsleep monitor

    by KIBO
    Replies
    1
    Views
    1,824

    unsleep monitor

    How can you get a monitor out of sleep mode in c#?

    I tried the following, but then the monitor wakes up and falls back to sleep mode immediately.


    uint SC_MONITORPOWER = 0xF170;
    uint...
  20. Replies
    0
    Views
    1,055

    LINQ: sorting by year

    I want to sort a list of price object by year but it just doesn't sort


    var query = from p in prices orderby p.StartDate descending select p;

    Is it possible to sort with LINQ on a certain...
  21. Replies
    4
    Views
    1,298

    No, like a tool that shows relations between...

    No, like a tool that shows relations between objects. When one object uses 10 times another object it would show 10 lines between the objects. I want to get the amount of coupling exposed
  22. Replies
    4
    Views
    1,298

    tool for exposing relations between objects?

    Is there a tool for C# that exposes coupling between objects by makeing a visual representation of the software?
  23. Replies
    3
    Views
    4,629

    Im learning c# and making software at the same...

    Im learning c# and making software at the same time. So ye Im guessing a lot on how to optimize things but this part needs optimization. Its a database which takes half an hour to retrieve which uses...
  24. Replies
    3
    Views
    4,629

    Guid default equality comparer

    I have a dictionary which maps a Guid to Orders, it contains like 350000 orders



    Dictionary<Guid, Order> htPreOrders = new Dictionary<Guid, PreOrder>(350000);


    Im trying to optimize it by...
  25. Thread: compiler bug?

    by KIBO
    Replies
    1
    Views
    1,211

    compiler bug?

    Why doesnt the following compile? the c in prices.Where() is not a declared variable in this scope right? Sounds like a compiler bug to me or am I missing something?



    int c = 0;

    List<Price>...
Results 1 to 25 of 330
Page 1 of 14 1 2 3 4