Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

ryancrawcour

@ryancrawcour
About
Posts
8
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Default parameter in Method
    R ryancrawcour

    it really isn't very scary ... all you're doing is creating an object (class or struct either way) that contains your parameters. you assign your defaults in your parameter object and pass that into your method. that way you can have one method that has the ability to have default values for a parameter. run the code sample i sent, step through it and you'll see exactly what it is doing ... if you still unclear, let me know and i'll explain it for you line by line ciao RC

    C# help question

  • Default parameter in Method
    R ryancrawcour

    you could do something like the following; class ParameterClass { public string Name; public int IDNumber; public ParameterClass() { //set some default values; //since both fields are public they can //be overridden if necessary this.Name = ""; this.IDNumber = 0; } } class OptionalParameters { [STAThread] static void Main(string[] args) { //instantiate a parameter class object //and override the name field ParameterClass c = new ParameterClass(); c.Name = "Lamont Adams"; optionalObject(c); //show that the changed ID came back Console.WriteLine("c.IDNumber={0}",c.IDNumber); //call the method with only defaults optionalObject(new ParameterClass()); //pause so we can see the output Console.ReadLine(); } public static void optionalObject(ParameterClass arg) { //because the parameters received are encapsulated //in an object, they are all optional but have //a valid state even if not explicitly set by the caller Console.WriteLine("arg.Name={0}, arg.IDNumber={1}", arg.Name, arg.IDNumber); //change one of the field values arg.IDNumber = 10; } } this way you don't have to have an overload for every single combination of parameters. hope this helps...

    C# help question

  • passing a struct
    R ryancrawcour

    VanEtienne wrote:

    Works if both classes are in the same file, but I want to do it between 2 different files.

    as long as the struct is declared as public it should be no problem. same syntax / method as passing a class an instance of another class.

    C# tutorial

  • C# 2.0 & 1.1 interop
    R ryancrawcour

    Answer me this ... I have an application that is built in .net 2.0. It references an assembly built in .net 1.1 What happens internally when my application uses the 1.1 assembly? Does it create a new process for the 1.1 CLR? Is it seamless? This is important to me because if there are cross process calls I presume that there will be some sort of performance impact, am I correct? Thanks Ryan

    C# csharp dotnet com performance question

  • goto in C#
    R ryancrawcour

    yeah indeed. perhaps you could consider getting each of your case statements to call functions instead of each other. not sure what your exact need is, but all i know is from previous experience that fallthrough statements come back to bite you in the butt later when you least expect them.

    C# csharp game-dev question

  • torture
    R ryancrawcour

    yup this is me signing in from sunny Knysna. gawd it's lovely here ... makes you forget about all the madness of daily life ! ahhhh the sea air, the warm african sun in your face, the wind whipping off the tops of the breakers. going off now to see about buying a new kite surfing setup. ciao all

    The Lounge com question lounge

  • vb6 webclass equivalent (or better) in asp.net ?
    R ryancrawcour

    thanks ... i have been toying with some ideas, of which some are good - others seem better. has anybody had experience in implementing this type of thing ? which method is best ? i am currently toying with the idea of using a base class that all pages inherit from. this base class will use user controls to dynamically build their content at runtime. each page will then only be concerned with what needs to be placed in the content section, the base class will handle the rest. is there an equivalent to visual inheritance in asp.net ? cheers Ryan

    Web Development question csharp asp-net sysadmin

  • vb6 webclass equivalent (or better) in asp.net ?
    R ryancrawcour

    howdy all, busy designing a new web application that would be perfectly suited to a webclass application. ie. one template page that defines the layout and within that layout tokens to define where runtime generated content should be placed. my question is this ... how should we be doing this kind of thing in asp.net ? should we build server controls and drop these onto the aspx pages ? should we build one page that serves as a template and the other pages inherit from this ? should we still use something similar to token substitution ? please help, any ideas ... suggestions ... guidance would be hugely appreciated cheers Ryan

    Web Development question csharp asp-net sysadmin
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups