Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

IntelliSense Suggestions


  • Please log in to reply
1 reply to this topic

#1 woof_woof_bark_bark

woof_woof_bark_bark

    New Member

  • Members
  • Pip
  • 8 posts

Posted 12 December 2014 - 06:28 PM

Hello World, I'm working on a driver and the basic gist/setup of the method is :

 

public enum

{

cat = 0,

dog = 1

}

 

 

public void SpecificChipFunctionality(int x, animals y)
        {
            
        }
 
I want to make the driver so that the user - when calling the method gets some sort of prompt from intellisense suggesting that "cat" should be used. The only way that I know how to do that is:
 
public void SpecificChipFunctionality(int x, animals y = animals.cat)
        {
            
        }
 
My issue with doing this is I have another method with the same name that takes in a byte, and if I want to call the byte form, Visual Studio converts my input (ex. 0x16) to an int and executes the wrong method.
 
Is there a way to suggest that a specific value is used without having to set it equal?
 
Thanks, 
woof_woof_bark_bark

 



#2 Miha Markic

Miha Markic

    Advanced Member

  • Members
  • PipPipPip
  • 74 posts
  • LocationNova Gorica, Slovenia

Posted 10 January 2015 - 10:43 AM

One solution could be that you name your methods differently. Or cast your value to byte when calling method. Other than that, C# will find most suitable method overload and if you are passing an int then the method will be the one with a default value.


Miha Markic, Microsoft MVP C#
Righthand .net consulting and software development
http://blog.rthand.com/





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.