User Profile

Collapse

Profile Sidebar

Collapse
ceestand
ceestand
Last Activity: Apr 8 '08, 02:02 PM
Joined: Mar 13 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • ceestand
    started a topic Referencing System.Type?
    in .NET

    Referencing System.Type?

    I'm trying to make a change to an object depending contextually on it's type. The following code, even though I pass the Int32 into the function as an Object, still knows it's an Int32.
    Code:
    public String FunctionName(Object obj)
    {
    return obj.GetType().ToString();
    }
    
    Int32 testObj = 0;
    FunctionName(testObj);
    //returns "System.Int32"
    However, the following...
    See more | Go to post

  • ceestand
    started a topic Regex match all whitespace before character
    in .NET

    Regex match all whitespace before character

    I'm trying to remove all whitepace in an HTML-formatted string, except within the actual content.

    so I want to get:
    Code:
    <p>   <b>some text</b> </p>
    to look like
    Code:
    <p><b>some text</b></p>
    I've been trying something like:
    Code:
    Regex r = new Regex(@"/s<);
    r.Replace(str, "<");
    with the idea being to replace...
    See more | Go to post

  • Search ArrayList for object with specific property value

    I have an ArrayList populated with user-defined objects. I want to find any objects where the value of one of those object's properties is X.

    In quasi-code:

    Obj[] NewArr = MyList.Select(w here Obj.SomePropery == X)

    Select won't work because the Obj object can have different, but non-distinct, property values.

    I'm out of ideas (that don't stink) ...
    See more | Go to post

  • ceestand
    replied to Get copy of cache item?
    in .NET
    Anyone have a guess?

    Bueller...?
    See more | Go to post

    Leave a comment:


  • ceestand
    started a topic Get copy of cache item?
    in .NET

    Get copy of cache item?

    I am having a weird (to me at least) problem retrieving a copy of an item in the Cache.

    I do something like this:
    Code:
    DataTable ToBeInserted = FunctionThatReturnsDataTable();
    Cache.Insert("CacheTable", ToBeInserted);
    public DataTable function()
    {
    DataTable Results = (DataTable)Cache[CacheTable];
    Results.Columns.Add("Rank");
    return Results;
    }
    On the second...
    See more | Go to post

  • ceestand
    replied to String.Contains Count?
    in .NET
    For anyone interested, this is what I ended up using:
    public Int32 ContainsCount(S tring SearchPhrase, String SearchText) {
    String Remains = SearchText;
    Int32 NewIndex = 0;
    Int16 Count = 0;
    while (Remains.Length >= SearchPhrase.Le ngth)
    {
    NewIndex = Remains.IndexOf (SearchPhrase);
    if (NewIndex >= 0)
    {
    Count++;
    Remains = Remains.Substri ng(NewIndex
    ...
    See more | Go to post

    Leave a comment:


  • ceestand
    replied to String.Contains Count?
    in .NET
    Thanks for your help.
    See more | Go to post

    Leave a comment:


  • ceestand
    started a topic String.Contains Count?
    in .NET

    String.Contains Count?

    Can anyone point me in the direction of functionality that will provide the number of times a String contains a given substring? Preferably in C# and/or built in to the .Net framework...
    See more | Go to post
No activity results to display
Show More
Working...