Tv Remote Control in C# - c#

I'm new using C# and I'm building a remote control. I got stuck and my code is not compiling. Please I need suggestions and how can I improve my code.
I think its Console.Readline() but I'm not sure how to use it. Also how can change this to 2 primary classes?
public class testRemote
{
public static bool PowerOn(bool powerStatus)
{
if (powerStatus == true)
{
testRemote.DisplayMessage("TV already on");
}
else
{
powerStatus = true;
testRemote.DisplayMessage("TV On, Your Channel is 3 and the Volume is 5");
}
return powerStatus;
}
public static bool PowerOff(bool powerStatus)
{
if (powerStatus == false)
{
testRemote.DisplayMessage("TV already off");
}
else
{
powerStatus = false;
testRemote.DisplayMessage("TV is now off");
}
return powerStatus;
}
public static int VolumeUp(bool powerStat, int vol)
{
if (powerStat == false)
{
testRemote.DisplayMessage("TV is off");
}
else
{
if (vol >= 10)
{
testRemote.DisplayMessage("TV is already on Maximum Volume.");
}
else
{
vol++;
if (vol == 10)
{
testRemote.DisplayMessage("Maximum Volume.");
}
}
}
return vol;
}
public static int VolumeDown(bool powerStat, int vol)
{
if (powerStat == false)
{
testRemote.DisplayMessage("TV is off");
}
else
{
if (vol <= 0)
{
testRemote.DisplayMessage("Sound Muted");
}
else
{
vol--;
if (vol == 0)
{
testRemote.DisplayMessage("Sound Muted");
}
}
}
return vol;
}
public static int ChannelUp(bool powerStat, int channelNo)
{
if (powerStat == false)
{
testRemote.DisplayMessage("TV is off");
}
else
{
if (channelNo < 99)
{
channelNo++;
}
else
{
channelNo = 2;
}
Console.WriteLine("Channel " + channelNo.ToString());
}
return channelNo;
}
public static int ChannelDown(bool powerStat, int channelNo)
{
if (powerStat == false)
{
testRemote.DisplayMessage("TV is off");
}
else
{
if (channelNo == 2)
{
channelNo = 99;
}
else
{
channelNo--;
}
Console.WriteLine("Channel " + channelNo.ToString());
}
return channelNo;
}
public static String SmartMenu(bool powerStat, String md)
{
if (powerStat == false)
{
testRemote.DisplayMessage("TV is off");
}
else
{
testRemote.DisplayMessage("Smart Menu On");
md = "TV";
}
return md;
}
public static String SetSettings(bool powerStat, String md)
{
if (powerStat == false)
{
testRemote.DisplayMessage("TV is off");
}
else
{
testRemote.DisplayMessage("Settings On");
md = "Settings";
}
return md;
}
public static void DisplayMessage(String msg)
{
Console.WriteLine(msg);
}
public static void Banner()
{
Console.WriteLine("Welcome to TV Remote Control");
Console.WriteLine("Please enter your selection");
Console.WriteLine("Power On - turns on your TV");
Console.WriteLine("Power Off - turns off your TV");
Console.WriteLine("Increase volume - turns up the volume");
Console.WriteLine("Decrease volume - turn down the volume");
Console.WriteLine("Channel Up - increments the channel");
Console.WriteLine("Channel Down - decrements the channel");
Console.WriteLine("Smart Menu");
Console.WriteLine("Settings");
Console.WriteLine();
Console.WriteLine("Please enter your selection");
}
public static void Main(String[] args)
{
bool powerOn = false;
int channel = 3;
int volume = 5;
string mode = "TV";
string choice = "Turn On";
string c = Console.ReadLine();
while (choice.ToLower().Equals("Exit".ToLower()) != true)
{
if (choice.ToLower().Equals("Power On".ToLower()) == true)
{
powerOn = testRemote.PowerOn(powerOn);
}
if (choice.ToLower().Equals("Power Off".ToLower()) == true)
{
powerOn = testRemote.PowerOff(powerOn);
}
if (choice.ToLower().Equals("Increase volume".ToLower()) == true)
{
volume = testRemote.VolumeUp(powerOn, volume);
}
if (choice.ToLower().Equals("Decrease volume".ToLower()) == true)
{
volume = testRemote.VolumeDown(powerOn, volume);
}
if (choice.ToLower().Equals("Channel Up".ToLower()) == true)
{
channel = testRemote.ChannelUp(powerOn, channel);
}
if (choice.ToLower().Equals("Channel Down".ToLower()) == true)
{
channel = testRemote.ChannelDown(powerOn, channel);
}
if (choice.ToLower().Equals("Mode TV".ToLower()) == true)
{
mode = testRemote.SmartMenu(powerOn, mode);
}
if (choice.ToLower().Equals("Mode DVD".ToLower()) == true)
{
mode = testRemote.SetSettings(powerOn, mode);
}
Console.WriteLine();
Console.WriteLine();
choice = Console.ReadLine();
}
Console.WriteLine("Thank you for the Remote Controller");
Console.ReadLine();
}
}

Since the question is not clear i slightly modified your code, it compiles and runs BUT needs a lot of refactor.
Here is the working code.
using System;
namespace TvRemote
{
public class testRemote
{
public static bool PowerOn(bool powerStatus)
{
if (powerStatus == true)
{
testRemote.DisplayMessage("TV already on");
}
else
{
powerStatus = true;
testRemote.DisplayMessage("TV On, Your Channel is 3 and the Volume is 5");
}
return powerStatus;
}
public static bool PowerOff(bool powerStatus)
{
if (powerStatus == false)
{
testRemote.DisplayMessage("TV already off");
}
else
{
powerStatus = false;
testRemote.DisplayMessage("TV is now off");
}
return powerStatus;
}
public static int VolumeUp(bool powerStat, int vol)
{
if (powerStat == false)
{
testRemote.DisplayMessage("TV is off");
}
else
{
if (vol >= 10)
{
testRemote.DisplayMessage("TV is already on Maximum Volume.");
}
else
{
vol++;
if (vol == 10)
{
testRemote.DisplayMessage("Maximum Volume.");
}
}
}
return vol;
}
public static int VolumeDown(bool powerStat, int vol)
{
if (powerStat == false)
{
testRemote.DisplayMessage("TV is off");
}
else
{
if (vol <= 0)
{
testRemote.DisplayMessage("Sound Muted");
}
else
{
vol--;
if (vol == 0)
{
testRemote.DisplayMessage("Sound Muted");
}
}
}
return vol;
}
public static int ChannelUp(bool powerStat, int channelNo)
{
if (powerStat == false)
{
testRemote.DisplayMessage("TV is off");
}
else
{
if (channelNo < 99)
{
channelNo++;
}
else
{
channelNo = 2;
}
Console.WriteLine("Channel " + channelNo.ToString());
}
return channelNo;
}
public static int ChannelDown(bool powerStat, int channelNo)
{
if (powerStat == false)
{
testRemote.DisplayMessage("TV is off");
}
else
{
if (channelNo == 2)
{
channelNo = 99;
}
else
{
channelNo--;
}
Console.WriteLine("Channel " + channelNo.ToString());
}
return channelNo;
}
public static String SmartMenu(bool powerStat, String md)
{
if (powerStat == false)
{
testRemote.DisplayMessage("TV is off");
}
else
{
testRemote.DisplayMessage("Smart Menu On");
md = "TV";
}
return md;
}
public static String SetSettings(bool powerStat, String md)
{
if (powerStat == false)
{
testRemote.DisplayMessage("TV is off");
}
else
{
testRemote.DisplayMessage("Settings On");
md = "Settings";
}
return md;
}
public static void DisplayMessage(String msg)
{
Console.WriteLine(msg);
}
public static void Banner()
{
Console.WriteLine("Welcome to TV Remote Control");
Console.WriteLine("Please enter your selection");
Console.WriteLine("Power On - turns on your TV");
Console.WriteLine("Power Off - turns off your TV");
Console.WriteLine("Increase volume - turns up the volume");
Console.WriteLine("Decrease volume - turn down the volume");
Console.WriteLine("Channel Up - increments the channel");
Console.WriteLine("Channel Down - decrements the channel");
Console.WriteLine("Smart Menu");
Console.WriteLine("Settings");
Console.WriteLine();
Console.WriteLine("Please enter your selection");
}
public static void Main(String[] args)
{
bool powerOn = false;
int channel = 3;
int volume = 5;
string mode = "TV";
//string choice = "Turn On"; //THIS MUST BE Power On if you want to power on the tv as soon as the app is launched
Banner();
string choice = Console.ReadLine();
while (!choice.ToLower().Equals("Exit".ToLower()))
{
if (choice.ToLower().Equals("Power On".ToLower()) == true)
{
powerOn = testRemote.PowerOn(powerOn);
}
if (choice.ToLower().Equals("Power Off".ToLower()) == true)
{
powerOn = testRemote.PowerOff(powerOn);
}
if (choice.ToLower().Equals("Increase volume".ToLower()) == true)
{
volume = testRemote.VolumeUp(powerOn, volume);
}
if (choice.ToLower().Equals("Decrease volume".ToLower()) == true)
{
volume = testRemote.VolumeDown(powerOn, volume);
}
if (choice.ToLower().Equals("Channel Up".ToLower()) == true)
{
channel = testRemote.ChannelUp(powerOn, channel);
}
if (choice.ToLower().Equals("Channel Down".ToLower()) == true)
{
channel = testRemote.ChannelDown(powerOn, channel);
}
if (choice.ToLower().Equals("Mode TV".ToLower()) == true)
{
mode = testRemote.SmartMenu(powerOn, mode);
}
if (choice.ToLower().Equals("Mode DVD".ToLower()) == true)
{
mode = testRemote.SetSettings(powerOn, mode);
}
Console.WriteLine();
Console.WriteLine();
choice = Console.ReadLine();
}
Console.WriteLine("Thank you for the Remote Controller");
Console.ReadLine();
}
}
}

Related

How to make a Interactive NPC in C# console?

I have the code shown here, and I would like to make a Interactive NPC.
Basically end the player was like next to the NPC/letter, the player would be able to interact with it either by pressing a key for example "E" or just by being close to it and show some text in the console.
How could I do it? I'm new to C# so I don't have much knowledge about it. If anyone has any tutorial or could explain with coding I would appreciate it.
The code is:
namespace SoulfulDungeon
{
class World
{
private string[,] Grid;
private int Rows;
private int Cols;
public World(string[,] grid)
{
Grid = grid;
Rows = Grid.GetLength(0);
Cols = Grid.GetLength(1);
}
public void Draw()
{
for (int y = 0; y < Rows; y++)
{
for (int x = 0; x < Cols; x++)
{
string element = Grid[y, x];
Console.SetCursorPosition(x, y);
Console.Write(element);
}
}
}
public string GetElementAt(int x, int y)
{
return Grid[y, x];
}
public string Trap(int x, int y)
{
return Grid[y, x];
}
public bool IsPositionWalkable(int x, int y)
{
//Verificar Limites
if (x < 0 || y < 0 || x >= Cols || y >= Rows)
{
return false;
}
if (Lever.LeverMarker == "K")
{
return Grid[y, x] == "(" || Grid[y, x] == " " || Grid[y, x] == "X" || Grid[y, x] == "T";
}
else if(Lever.LeverMarker != "K")
{
//Verificar locais de passagem
return Grid[y, x] == " " || Grid[y, x] == "X" || Grid[y, x] == "T";
}
return false;
}
}
public class SwitchDeath //metodo escolhas switch
{
public static int Variavel1;
public static int Variavel2;
public static void Choices()
{
bool Key = false; //escolha através de keys
do
{
ConsoleKeyInfo keyReaded = Console.ReadKey(true);
switch (keyReaded.Key)
{
case ConsoleKey.Q:
Variavel1 = 1;
Key = true;
Console.WriteLine("You pulled the lever");
break;
case ConsoleKey.E:
Variavel2 = 1;
Key = true;
Console.WriteLine("You turned on the switch... a rain of arrows fell in your head...");
break;
default:
Console.WriteLine("You chose to stay still... The darkness consumed you and your conscience was washed away");
Variavel2 = 1;
Key = true;
break;
}
} while(!Key);
if (Variavel1 == 1)
{
Console.WriteLine("The room");
}
if (Variavel2 == 1)
{
Console.WriteLine("you died");
Environment.Exit(0);
}
}
}
class Variables
{
public int X { get; set;}
public int Y { get; set;}
public static string? EnemyMarker;
public static ConsoleColor EnemyColor;
public static string? PlayerMarker;
public static ConsoleColor PlayerColor;
public static string? LeverMarker;
public static ConsoleColor LeverColor;
public static string? DoorMarker;
}
class Player : Variables
{
public Player( int initialX, int initialY)
{
X = initialX;
Y = initialY;
PlayerMarker = "0";
PlayerColor = ConsoleColor.Blue;
}
public void Draw()
{
Console.ForegroundColor = PlayerColor;
Console.SetCursorPosition(X, Y);
Console.Write(PlayerMarker);
Console.ResetColor();
}
}
class Enemy : Variables
{
public Enemy( int initialX, int initialY)
{
X = initialX;
Y = initialY;
EnemyMarker = "5";
EnemyColor = ConsoleColor.Red;
}
public void Draw()
{
Console.ForegroundColor = EnemyColor;
Console.SetCursorPosition(X, Y);
Console.Write(EnemyMarker);
Console.ResetColor();
}
}
class Lever : Variables
{
public Lever( int initialX, int initialY)
{
X = initialX;
Y = initialY;
LeverMarker = "k";
LeverColor = ConsoleColor.Yellow;
}
public void Draw()
{
Console.ForegroundColor = LeverColor;
Console.SetCursorPosition(X, Y);
Console.Write(LeverMarker);
Console.ResetColor();
}
}
class Door : Variables
{
public Door( int initialX, int initialY)
{
X = initialX;
Y = initialY;
DoorMarker = " ";
}
public void Draw()
{
Console.SetCursorPosition(X, Y);
Console.Write(DoorMarker);
}
}
class Program
{
private static World? MyWorld;
private static Player? CurrentPlayer;
private static Enemy? CurrentEnemy;
private static Lever? CurrentLever;
private static Door? CurrentDoor;
public static void Main(string[] args)
{
Console.CursorVisible = false;
Console.WriteLine("You found a lever and a switch :O");
System.Threading.Thread.Sleep(150);
Console.WriteLine("Choose: Press 'Q' to pull the lever | Press 'E' to turn the switch");
SwitchDeath.Choices();
string [,] grid = LevelParser.ParseFileToArray("Level0.txt");
MyWorld = new World(grid);
CurrentPlayer = new Player(0, 5);
//CurrentEnemy = new Enemy(2, 1);
CurrentLever = new Lever (11, 3);
CurrentDoor = new Door (11, 6);
RunGameLoop();
}
private static void DrawFrame()
{
Console.Clear();
MyWorld!.Draw();
CurrentPlayer!.Draw();
CurrentLever!.Draw();
if (Lever.LeverMarker == "K")
{
CurrentDoor!.Draw();
CurrentPlayer!.Draw();
CurrentLever!.Draw();
}
}
class Detection
{
public static void DetectionLever()
{
if (CurrentPlayer is not null)
if (CurrentLever is not null)
if (CurrentPlayer.Y == CurrentLever.Y)
{
if (CurrentPlayer.X == CurrentLever.X)
{
Lever.LeverMarker = "K";
Lever.LeverColor = ConsoleColor.DarkYellow;
}
}
}
public static void DetectionEnemy()
{
if (CurrentPlayer is not null)
if (CurrentEnemy is not null)
if (CurrentPlayer.Y == CurrentEnemy.Y)
{
if (CurrentPlayer.X == CurrentEnemy.X)
{
Console.Clear();
Console.WriteLine("You died... Don't touch the ghouls...");
CurrentPlayer = new Player(0, 5);
CurrentPlayer!.Draw();
}
}
}
}
private static void HandlePlayerInput()
{
ConsoleKeyInfo keyInfo = Console.ReadKey(true);
ConsoleKey key = keyInfo.Key;
if (MyWorld is not null)
if (CurrentPlayer is not null)
switch (key)
{
case ConsoleKey.UpArrow:
if (MyWorld.IsPositionWalkable(CurrentPlayer.X, CurrentPlayer.Y - 1))
{
CurrentPlayer.Y -= 1;
}
break;
case ConsoleKey.DownArrow:
if (MyWorld.IsPositionWalkable(CurrentPlayer.X, CurrentPlayer.Y + 1))
{
CurrentPlayer.Y += 1;
}
break;
case ConsoleKey.LeftArrow:
if (MyWorld.IsPositionWalkable(CurrentPlayer.X - 1 , CurrentPlayer.Y))
{
CurrentPlayer.X -= 1;
}
break;
case ConsoleKey.RightArrow:
if (MyWorld.IsPositionWalkable(CurrentPlayer.X + 1, CurrentPlayer.Y))
{
CurrentPlayer.X += 1;
}
break;
case ConsoleKey.E:
Console.Clear();
Environment.Exit(0);
break;
default:
break;
}
}
private static void RunGameLoopEnemy()
{
if (MyWorld is not null)
if(CurrentPlayer is not null)
while(true)
{
DrawFrame();
HandlePlayerInput();
Detection.DetectionLever();
Detection.DetectionEnemy();
string elementAtPlayerPros = MyWorld.GetElementAt(CurrentPlayer.X, CurrentPlayer.Y);
if (elementAtPlayerPros == "X")
{
Console.Clear();
break;
}
string Traps = MyWorld.Trap(CurrentPlayer.X, CurrentPlayer.Y);
if (Traps == "T")
{
Console.Clear();
break;
}
System.Threading.Thread.Sleep(20);
}
}
private static void RunGameLoop()
{
if (MyWorld is not null)
if(CurrentPlayer is not null)
while(true)
{
DrawFrame();
HandlePlayerInput();
Detection.DetectionLever();
string elementAtPlayerPros = MyWorld.GetElementAt(CurrentPlayer.X, CurrentPlayer.Y);
if (elementAtPlayerPros == "X")
{
Console.Clear();
break;
}
string Traps = MyWorld.Trap(CurrentPlayer.X, CurrentPlayer.Y);
if (Traps == "T")
{
Console.Clear();
break;
}
System.Threading.Thread.Sleep(20);
}
}
}
}
Didn't try anything yet because I don't really know how I could do it

Struct and loop concept

I am having a problem about structures. I am trying to calculate quadrengles parameter, area and whether it is square or not but code doesn't go to if else part of islem();. This is my homework about struct.
using System;
public struct Str
{
private double val;
public double Value
{
get { return val; }
set { val = value; }
}
public double Oku()
{
return double.Parse(Console.ReadLine());
}
}
public struct Dörtgen
{
Str ak;
Str bk;
public Str Ake
{
get { return ak; }
set { ak = value; }
}
public Str Bke
{
get { return bk; }
set { bk = value; }
}
public void Dörtgen1()
{
Str rct = new Str();
Console.WriteLine("\nenter sides a and be of the square: ");
Console.Write("A side: ");
ak.Value = rct.Oku();
Console.Write("B side: ");
bk.Value = rct.Oku();
}
public void İslem()
{
Console.WriteLine("parameter: {0}", (Ake.Value + Bke.Value) * 2);
Console.WriteLine("area: {0}\n", Ake.Value * Bke.Value);
if (Ake.Value == Bke.Value)
{
Console.WriteLine("this is a square");
}
else if (Ake.Value == Bke.Value)
{
Console.WriteLine("this is not a square");
}
}
}
public class Program
{
static void Main()
{
var drg = new Dörtgen();
drg.Dörtgen1();
Console.WriteLine();
Console.WriteLine("parameter and area");
drg.İslem();
}
}
if (Ake.Value == Bke.Value)
{
Console.WriteLine("this is a square");
}
else if (Ake.Value == Bke.Value)
{
Console.WriteLine("this is not a square");
}
Should be:
// Sides are equal: it's a square
if (Ake.Value == Bke.Value)
{
Console.WriteLine("this is a square");
}
// didn't enter the "square" branch, so it's not a square
else
{
Console.WriteLine("this is not a square");
}
Explanation: Besides the fact that you wrote Ake.Value == Bke.Value in both if and else if, you don't actually need to check anything if the first if is false, you can just go to the else branch.

How to assign value to global array from void?

Hello.I am currently working on a VS form app with pictureboxes gerating random images.Down below i have posted a simplified version of my programme, where error occurs.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
BackgroundImageLayout = ImageLayout.Stretch;
}
int[] random = new int[16];
public void LoadImages()
{
List<Image> images = new List<Image>();
Random rand = new Random();
images.Add(Properties.strings.firsthero);
images.Add(Properties.strings.secondhero);
images.Add(Properties.strings.thirdhero);
images.Add(Properties.strings.fourthhero);
images.Add(Properties.strings.fifthhero);
images.Add(Properties.strings.sixthhero);
images.Add(Properties.strings.seventhhero);
images.Add(Properties.strings.eighthero);
images.Add(Properties.strings.ninethhero);
images.Add(Properties.strings.tenthhero);
images.Add(Properties.strings.eleventhhero);
images.Add(Properties.strings.twelevethhero);
images.Add(Properties.strings.thirteenthhero);
images.Add(Properties.strings.fourteenthhero);
images.Add(Properties.strings.fifteenthhero);
random[0] = rand.Next(images.Count);
pictureBox1.Image = images[random[0]];
random[1] = rand.Next(images.Count);
pictureBox2.Image = images[random[1]];
random[2] = rand.Next(images.Count);
pictureBox3.Image = images[random[2]];
random[3] = rand.Next(images.Count);
pictureBox4.Image = images[random[3]];
random[4] = rand.Next(images.Count);
pictureBox5.Image = images[random[4]];
random[5] = rand.Next(images.Count);
pictureBox6.Image = images[random[5]];
random[6] = rand.Next(images.Count);
pictureBox7.Image = images[random[6]];
random[7] = rand.Next(images.Count);
pictureBox8.Image = images[random[7]];
random[8] = rand.Next(images.Count);
pictureBox9.Image = images[random[8]];
random[9] = rand.Next(images.Count);
pictureBox10.Image = images[random[9]];
random[10] = rand.Next(images.Count);
pictureBox11.Image = images[random[10]];
random[11] = rand.Next(images.Count);
pictureBox12.Image = images[random[11]];
random[12] = rand.Next(images.Count);
pictureBox13.Image = images[random[12]];
random[13] = rand.Next(images.Count);
pictureBox14.Image = images[random[13]];
random[14] = rand.Next(images.Count);
pictureBox15.Image = images[random[14]];
random[15] = rand.Next(images.Count);
pictureBox16.Image = images[random[15]];
}
private void btnStart_Click(object sender, EventArgs e)
{
LoadImages();
}
private void button2_Click(object sender, EventArgs e)
{
button2.Visible = false;
button2WasClicked = true;
button1Match();
//the same for other buttons
}
public void button1Match()
{
if(button1WasClicked == true)
{
if(button2WasClicked == true)
{
if (random[0] == random[1])
{
winsNumber++;
}
}
else if(button3WasClicked == true)
{
if (random[0] == random[2])
{
winsNumber++;
}
}
else if(button4WasClicked == true)
{
if (random[0] == random[3])
{
winsNumber++;
}
}
else if(button5WasClicked == true)
{
if (random[0] == random[4])
{
winsNumber++;
}
}
else if(button6WasClicked == true)
{
if (random[0] == random[5])
{
winsNumber++;
}
}
else if(button7WasClicked == true)
{
if (random[0] == random[6])
{
winsNumber++;
}
}
else if(button8WasClicked == true)
{
if (random[0] == random[7])
{
winsNumber++;
}
}
else if(button9WasClicked == true)
{
if (random[0] == random[8])
{
winsNumber++;
}
}
else if(button10WasClicked == true)
{
if(random[0] == random[9])
{
winsNumber++;
}
}
else if(button11WasClicked == true)
{
if (random[0] == random[10])
{
winsNumber++;
}
}
else if(button12WasClicked == true)
{
if (random[0] == random[11])
{
winsNumber++;
}
}
else if(button13WasClicked == true)
{
if (random[0] == random[12])
{
winsNumber++;
}
}
else if(button14WasClicked == true)
{
if (random[0] == random[13])
{
winsNumber++;
}
}
else if(button15WasClicked == true)
{
if (random[0] == random[14])
{
winsNumber++;
}
}
else if(button16WasClicked == true)
{
if (random[0] == random[15])
{
winsNumber++;
}
}
}
wins.Text = winsNumber.ToString();
}
So basically I am generatinf random indexes from image list and via them show random images in picture boxes.To find out whether a match between two pictures occurs, I check the indexes of the images in the buttons.
However the problem is that the random[0] = rand.Next(images.Count); only genrates number in the void, and does not assign random[0] value to the global array. Possible solutins?

How to combine two strings into the name of another string and call that string?

is there any way to simplify this code into a few lines, I have a class with string seq(number) has {get;set} functions. I am getting lucio and textValue from another class.
public static void setCategorySeq(string lucio, string textValue)
{
if (lucio == "0") { seq0 = textValue; }
else if (lucio == "1") { seq1 = textValue; }
else if (lucio == "2") { seq2 = textValue; }
else if (lucio == "3") { seq3 = textValue; }
else if (lucio == "4") { seq4 = textValue; }
else if (lucio == "5") { seq5 = textValue; }
else if (lucio == "6") { seq6 = textValue; }
else if (lucio == "7") { seq7 = textValue; }
else if (lucio == "8") { seq8 = textValue; }
else if (lucio == "9") { seq9 = textValue; }
else if (lucio == "10") { seq10 = textValue; }
else if (lucio == "11") { seq11 = textValue; }
else if (lucio == "12") { seq12 = textValue; }
else if (lucio == "13") { seq13 = textValue; }
else if (lucio == "14") { seq14 = textValue; }
else if (lucio == "15") { seq15 = textValue; }
}
May be this could help you reducing the LOC.
public static void setCategorySeq(string lucio, string textValue)
{
string[] seq = new string[16];
for (int i = 0; i <= 15; i++)
{
if (lucio == i.ToString())
seq[i] = textValue;
}
}
Maybe this code will suit you:
static Dictionary<string, string> seq = new Dictionary<string, string>();
public static void setCategorySeq(string lucio, string textValue)
{
seq[lucio] = textValue;
}
public static string setCategorySeq(string lucio)
{
if (seq.ContainsKey(lucio))
return seq[lucio];
return null;
}
Just use a dictionary
var lookup = new Dictionary<string,string>();
then to set an entry in the dictionary
lookup[lucio] = textValue;
and to access it
Console.WriteLine(lookup[lucio])
if you really want to verify that the string is a value between 0 an 15 then parse it first and validate it and use a dictionary with integer as a key
var lookup = new Dictionary<int,string>();
// Using C# 7 notation
if(int.TryParse(lucio, var out lucioInt) && lucionInt > 0 && lucioInt < 16){
lookup[lucioInt] = textValue;
}
I hope this might help
public static void setCategorySeq(string lucio, string textValue)
{
var seq = new string[15];
int noOfsequence=15;
for(int i=0;i<noOfsequence;i++)
{
if(lucio==i.ToString())
{
seq[i] = textValue;
break;
}
}
}

How can i enumerate methods inside this class?

When i check via debug, i can see the methods and variables but no matter what solution i have tried posted on stackoverflow failed
Here how i can see the methods with debug
Here the class
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class PlayerStats : pb::IMessage<PlayerStats>
{
/// <summary>Field number for the "level" field.</summary>
public const int LevelFieldNumber = 1;
/// <summary>Field number for the "experience" field.</summary>
public const int ExperienceFieldNumber = 2;
/// <summary>Field number for the "prev_level_xp" field.</summary>
public const int PrevLevelXpFieldNumber = 3;
/// <summary>Field number for the "next_level_xp" field.</summary>
public const int NextLevelXpFieldNumber = 4;
/// <summary>Field number for the "km_walked" field.</summary>
public const int KmWalkedFieldNumber = 5;
/// <summary>Field number for the "pokemons_encountered" field.</summary>
public const int PokemonsEncounteredFieldNumber = 6;
/// <summary>Field number for the "unique_pokedex_entries" field.</summary>
public const int UniquePokedexEntriesFieldNumber = 7;
/// <summary>Field number for the "pokemons_captured" field.</summary>
public const int PokemonsCapturedFieldNumber = 8;
/// <summary>Field number for the "evolutions" field.</summary>
public const int EvolutionsFieldNumber = 9;
/// <summary>Field number for the "poke_stop_visits" field.</summary>
public const int PokeStopVisitsFieldNumber = 10;
/// <summary>Field number for the "pokeballs_thrown" field.</summary>
public const int PokeballsThrownFieldNumber = 11;
/// <summary>Field number for the "eggs_hatched" field.</summary>
public const int EggsHatchedFieldNumber = 12;
/// <summary>Field number for the "big_magikarp_caught" field.</summary>
public const int BigMagikarpCaughtFieldNumber = 13;
/// <summary>Field number for the "battle_attack_won" field.</summary>
public const int BattleAttackWonFieldNumber = 14;
/// <summary>Field number for the "battle_attack_total" field.</summary>
public const int BattleAttackTotalFieldNumber = 15;
/// <summary>Field number for the "battle_defended_won" field.</summary>
public const int BattleDefendedWonFieldNumber = 16;
/// <summary>Field number for the "battle_training_won" field.</summary>
public const int BattleTrainingWonFieldNumber = 17;
/// <summary>Field number for the "battle_training_total" field.</summary>
public const int BattleTrainingTotalFieldNumber = 18;
/// <summary>Field number for the "prestige_raised_total" field.</summary>
public const int PrestigeRaisedTotalFieldNumber = 19;
/// <summary>Field number for the "prestige_dropped_total" field.</summary>
public const int PrestigeDroppedTotalFieldNumber = 20;
/// <summary>Field number for the "pokemon_deployed" field.</summary>
public const int PokemonDeployedFieldNumber = 21;
/// <summary>Field number for the "pokemon_caught_by_type" field.</summary>
public const int PokemonCaughtByTypeFieldNumber = 22;
/// <summary>Field number for the "small_rattata_caught" field.</summary>
public const int SmallRattataCaughtFieldNumber = 23;
private static readonly pb::MessageParser<PlayerStats> _parser =
new pb::MessageParser<PlayerStats>(() => new PlayerStats());
private int battleAttackTotal_;
private int battleAttackWon_;
private int battleDefendedWon_;
private int battleTrainingTotal_;
private int battleTrainingWon_;
private int bigMagikarpCaught_;
private int eggsHatched_;
private int evolutions_;
private long experience_;
private float kmWalked_;
private int level_;
private long nextLevelXp_;
private int pokeballsThrown_;
private pb::ByteString pokemonCaughtByType_ = pb::ByteString.Empty;
private int pokemonDeployed_;
private int pokemonsCaptured_;
private int pokemonsEncountered_;
private int pokeStopVisits_;
private int prestigeDroppedTotal_;
private int prestigeRaisedTotal_;
private long prevLevelXp_;
private int smallRattataCaught_;
private int uniquePokedexEntries_;
public PlayerStats()
{
OnConstruction();
}
public PlayerStats(PlayerStats other) : this()
{
level_ = other.level_;
experience_ = other.experience_;
prevLevelXp_ = other.prevLevelXp_;
nextLevelXp_ = other.nextLevelXp_;
kmWalked_ = other.kmWalked_;
pokemonsEncountered_ = other.pokemonsEncountered_;
uniquePokedexEntries_ = other.uniquePokedexEntries_;
pokemonsCaptured_ = other.pokemonsCaptured_;
evolutions_ = other.evolutions_;
pokeStopVisits_ = other.pokeStopVisits_;
pokeballsThrown_ = other.pokeballsThrown_;
eggsHatched_ = other.eggsHatched_;
bigMagikarpCaught_ = other.bigMagikarpCaught_;
battleAttackWon_ = other.battleAttackWon_;
battleAttackTotal_ = other.battleAttackTotal_;
battleDefendedWon_ = other.battleDefendedWon_;
battleTrainingWon_ = other.battleTrainingWon_;
battleTrainingTotal_ = other.battleTrainingTotal_;
prestigeRaisedTotal_ = other.prestigeRaisedTotal_;
prestigeDroppedTotal_ = other.prestigeDroppedTotal_;
pokemonDeployed_ = other.pokemonDeployed_;
pokemonCaughtByType_ = other.pokemonCaughtByType_;
smallRattataCaught_ = other.smallRattataCaught_;
}
public static pb::MessageParser<PlayerStats> Parser
{
get { return _parser; }
}
public static pbr::MessageDescriptor Descriptor
{
get { return global::PokemonGo.RocketAPI.GeneratedCode.PayloadsReflection.Descriptor.MessageTypes[14]; }
}
public int Level
{
get { return level_; }
set { level_ = value; }
}
public long Experience
{
get { return experience_; }
set { experience_ = value; }
}
public long PrevLevelXp
{
get { return prevLevelXp_; }
set { prevLevelXp_ = value; }
}
public long NextLevelXp
{
get { return nextLevelXp_; }
set { nextLevelXp_ = value; }
}
public float KmWalked
{
get { return kmWalked_; }
set { kmWalked_ = value; }
}
public int PokemonsEncountered
{
get { return pokemonsEncountered_; }
set { pokemonsEncountered_ = value; }
}
public int UniquePokedexEntries
{
get { return uniquePokedexEntries_; }
set { uniquePokedexEntries_ = value; }
}
public int PokemonsCaptured
{
get { return pokemonsCaptured_; }
set { pokemonsCaptured_ = value; }
}
public int Evolutions
{
get { return evolutions_; }
set { evolutions_ = value; }
}
public int PokeStopVisits
{
get { return pokeStopVisits_; }
set { pokeStopVisits_ = value; }
}
public int PokeballsThrown
{
get { return pokeballsThrown_; }
set { pokeballsThrown_ = value; }
}
public int EggsHatched
{
get { return eggsHatched_; }
set { eggsHatched_ = value; }
}
public int BigMagikarpCaught
{
get { return bigMagikarpCaught_; }
set { bigMagikarpCaught_ = value; }
}
public int BattleAttackWon
{
get { return battleAttackWon_; }
set { battleAttackWon_ = value; }
}
public int BattleAttackTotal
{
get { return battleAttackTotal_; }
set { battleAttackTotal_ = value; }
}
public int BattleDefendedWon
{
get { return battleDefendedWon_; }
set { battleDefendedWon_ = value; }
}
public int BattleTrainingWon
{
get { return battleTrainingWon_; }
set { battleTrainingWon_ = value; }
}
public int BattleTrainingTotal
{
get { return battleTrainingTotal_; }
set { battleTrainingTotal_ = value; }
}
public int PrestigeRaisedTotal
{
get { return prestigeRaisedTotal_; }
set { prestigeRaisedTotal_ = value; }
}
public int PrestigeDroppedTotal
{
get { return prestigeDroppedTotal_; }
set { prestigeDroppedTotal_ = value; }
}
public int PokemonDeployed
{
get { return pokemonDeployed_; }
set { pokemonDeployed_ = value; }
}
/// <summary>
/// TODO: repeated PokemonType ??
/// </summary>
public pb::ByteString PokemonCaughtByType
{
get { return pokemonCaughtByType_; }
set { pokemonCaughtByType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); }
}
public int SmallRattataCaught
{
get { return smallRattataCaught_; }
set { smallRattataCaught_ = value; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor
{
get { return Descriptor; }
}
public PlayerStats Clone()
{
return new PlayerStats(this);
}
public bool Equals(PlayerStats other)
{
if (ReferenceEquals(other, null))
{
return false;
}
if (ReferenceEquals(other, this))
{
return true;
}
if (Level != other.Level) return false;
if (Experience != other.Experience) return false;
if (PrevLevelXp != other.PrevLevelXp) return false;
if (NextLevelXp != other.NextLevelXp) return false;
if (KmWalked != other.KmWalked) return false;
if (PokemonsEncountered != other.PokemonsEncountered) return false;
if (UniquePokedexEntries != other.UniquePokedexEntries) return false;
if (PokemonsCaptured != other.PokemonsCaptured) return false;
if (Evolutions != other.Evolutions) return false;
if (PokeStopVisits != other.PokeStopVisits) return false;
if (PokeballsThrown != other.PokeballsThrown) return false;
if (EggsHatched != other.EggsHatched) return false;
if (BigMagikarpCaught != other.BigMagikarpCaught) return false;
if (BattleAttackWon != other.BattleAttackWon) return false;
if (BattleAttackTotal != other.BattleAttackTotal) return false;
if (BattleDefendedWon != other.BattleDefendedWon) return false;
if (BattleTrainingWon != other.BattleTrainingWon) return false;
if (BattleTrainingTotal != other.BattleTrainingTotal) return false;
if (PrestigeRaisedTotal != other.PrestigeRaisedTotal) return false;
if (PrestigeDroppedTotal != other.PrestigeDroppedTotal) return false;
if (PokemonDeployed != other.PokemonDeployed) return false;
if (PokemonCaughtByType != other.PokemonCaughtByType) return false;
if (SmallRattataCaught != other.SmallRattataCaught) return false;
return true;
}
public void WriteTo(pb::CodedOutputStream output)
{
if (Level != 0)
{
output.WriteRawTag(8);
output.WriteInt32(Level);
}
if (Experience != 0L)
{
output.WriteRawTag(16);
output.WriteInt64(Experience);
}
if (PrevLevelXp != 0L)
{
output.WriteRawTag(24);
output.WriteInt64(PrevLevelXp);
}
if (NextLevelXp != 0L)
{
output.WriteRawTag(32);
output.WriteInt64(NextLevelXp);
}
if (KmWalked != 0F)
{
output.WriteRawTag(45);
output.WriteFloat(KmWalked);
}
if (PokemonsEncountered != 0)
{
output.WriteRawTag(48);
output.WriteInt32(PokemonsEncountered);
}
if (UniquePokedexEntries != 0)
{
output.WriteRawTag(56);
output.WriteInt32(UniquePokedexEntries);
}
if (PokemonsCaptured != 0)
{
output.WriteRawTag(64);
output.WriteInt32(PokemonsCaptured);
}
if (Evolutions != 0)
{
output.WriteRawTag(72);
output.WriteInt32(Evolutions);
}
if (PokeStopVisits != 0)
{
output.WriteRawTag(80);
output.WriteInt32(PokeStopVisits);
}
if (PokeballsThrown != 0)
{
output.WriteRawTag(88);
output.WriteInt32(PokeballsThrown);
}
if (EggsHatched != 0)
{
output.WriteRawTag(96);
output.WriteInt32(EggsHatched);
}
if (BigMagikarpCaught != 0)
{
output.WriteRawTag(104);
output.WriteInt32(BigMagikarpCaught);
}
if (BattleAttackWon != 0)
{
output.WriteRawTag(112);
output.WriteInt32(BattleAttackWon);
}
if (BattleAttackTotal != 0)
{
output.WriteRawTag(120);
output.WriteInt32(BattleAttackTotal);
}
if (BattleDefendedWon != 0)
{
output.WriteRawTag(128, 1);
output.WriteInt32(BattleDefendedWon);
}
if (BattleTrainingWon != 0)
{
output.WriteRawTag(136, 1);
output.WriteInt32(BattleTrainingWon);
}
if (BattleTrainingTotal != 0)
{
output.WriteRawTag(144, 1);
output.WriteInt32(BattleTrainingTotal);
}
if (PrestigeRaisedTotal != 0)
{
output.WriteRawTag(152, 1);
output.WriteInt32(PrestigeRaisedTotal);
}
if (PrestigeDroppedTotal != 0)
{
output.WriteRawTag(160, 1);
output.WriteInt32(PrestigeDroppedTotal);
}
if (PokemonDeployed != 0)
{
output.WriteRawTag(168, 1);
output.WriteInt32(PokemonDeployed);
}
if (PokemonCaughtByType.Length != 0)
{
output.WriteRawTag(178, 1);
output.WriteBytes(PokemonCaughtByType);
}
if (SmallRattataCaught != 0)
{
output.WriteRawTag(184, 1);
output.WriteInt32(SmallRattataCaught);
}
}
public int CalculateSize()
{
var size = 0;
if (Level != 0)
{
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Level);
}
if (Experience != 0L)
{
size += 1 + pb::CodedOutputStream.ComputeInt64Size(Experience);
}
if (PrevLevelXp != 0L)
{
size += 1 + pb::CodedOutputStream.ComputeInt64Size(PrevLevelXp);
}
if (NextLevelXp != 0L)
{
size += 1 + pb::CodedOutputStream.ComputeInt64Size(NextLevelXp);
}
if (KmWalked != 0F)
{
size += 1 + 4;
}
if (PokemonsEncountered != 0)
{
size += 1 + pb::CodedOutputStream.ComputeInt32Size(PokemonsEncountered);
}
if (UniquePokedexEntries != 0)
{
size += 1 + pb::CodedOutputStream.ComputeInt32Size(UniquePokedexEntries);
}
if (PokemonsCaptured != 0)
{
size += 1 + pb::CodedOutputStream.ComputeInt32Size(PokemonsCaptured);
}
if (Evolutions != 0)
{
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Evolutions);
}
if (PokeStopVisits != 0)
{
size += 1 + pb::CodedOutputStream.ComputeInt32Size(PokeStopVisits);
}
if (PokeballsThrown != 0)
{
size += 1 + pb::CodedOutputStream.ComputeInt32Size(PokeballsThrown);
}
if (EggsHatched != 0)
{
size += 1 + pb::CodedOutputStream.ComputeInt32Size(EggsHatched);
}
if (BigMagikarpCaught != 0)
{
size += 1 + pb::CodedOutputStream.ComputeInt32Size(BigMagikarpCaught);
}
if (BattleAttackWon != 0)
{
size += 1 + pb::CodedOutputStream.ComputeInt32Size(BattleAttackWon);
}
if (BattleAttackTotal != 0)
{
size += 1 + pb::CodedOutputStream.ComputeInt32Size(BattleAttackTotal);
}
if (BattleDefendedWon != 0)
{
size += 2 + pb::CodedOutputStream.ComputeInt32Size(BattleDefendedWon);
}
if (BattleTrainingWon != 0)
{
size += 2 + pb::CodedOutputStream.ComputeInt32Size(BattleTrainingWon);
}
if (BattleTrainingTotal != 0)
{
size += 2 + pb::CodedOutputStream.ComputeInt32Size(BattleTrainingTotal);
}
if (PrestigeRaisedTotal != 0)
{
size += 2 + pb::CodedOutputStream.ComputeInt32Size(PrestigeRaisedTotal);
}
if (PrestigeDroppedTotal != 0)
{
size += 2 + pb::CodedOutputStream.ComputeInt32Size(PrestigeDroppedTotal);
}
if (PokemonDeployed != 0)
{
size += 2 + pb::CodedOutputStream.ComputeInt32Size(PokemonDeployed);
}
if (PokemonCaughtByType.Length != 0)
{
size += 2 + pb::CodedOutputStream.ComputeBytesSize(PokemonCaughtByType);
}
if (SmallRattataCaught != 0)
{
size += 2 + pb::CodedOutputStream.ComputeInt32Size(SmallRattataCaught);
}
return size;
}
public void MergeFrom(PlayerStats other)
{
if (other == null)
{
return;
}
if (other.Level != 0)
{
Level = other.Level;
}
if (other.Experience != 0L)
{
Experience = other.Experience;
}
if (other.PrevLevelXp != 0L)
{
PrevLevelXp = other.PrevLevelXp;
}
if (other.NextLevelXp != 0L)
{
NextLevelXp = other.NextLevelXp;
}
if (other.KmWalked != 0F)
{
KmWalked = other.KmWalked;
}
if (other.PokemonsEncountered != 0)
{
PokemonsEncountered = other.PokemonsEncountered;
}
if (other.UniquePokedexEntries != 0)
{
UniquePokedexEntries = other.UniquePokedexEntries;
}
if (other.PokemonsCaptured != 0)
{
PokemonsCaptured = other.PokemonsCaptured;
}
if (other.Evolutions != 0)
{
Evolutions = other.Evolutions;
}
if (other.PokeStopVisits != 0)
{
PokeStopVisits = other.PokeStopVisits;
}
if (other.PokeballsThrown != 0)
{
PokeballsThrown = other.PokeballsThrown;
}
if (other.EggsHatched != 0)
{
EggsHatched = other.EggsHatched;
}
if (other.BigMagikarpCaught != 0)
{
BigMagikarpCaught = other.BigMagikarpCaught;
}
if (other.BattleAttackWon != 0)
{
BattleAttackWon = other.BattleAttackWon;
}
if (other.BattleAttackTotal != 0)
{
BattleAttackTotal = other.BattleAttackTotal;
}
if (other.BattleDefendedWon != 0)
{
BattleDefendedWon = other.BattleDefendedWon;
}
if (other.BattleTrainingWon != 0)
{
BattleTrainingWon = other.BattleTrainingWon;
}
if (other.BattleTrainingTotal != 0)
{
BattleTrainingTotal = other.BattleTrainingTotal;
}
if (other.PrestigeRaisedTotal != 0)
{
PrestigeRaisedTotal = other.PrestigeRaisedTotal;
}
if (other.PrestigeDroppedTotal != 0)
{
PrestigeDroppedTotal = other.PrestigeDroppedTotal;
}
if (other.PokemonDeployed != 0)
{
PokemonDeployed = other.PokemonDeployed;
}
if (other.PokemonCaughtByType.Length != 0)
{
PokemonCaughtByType = other.PokemonCaughtByType;
}
if (other.SmallRattataCaught != 0)
{
SmallRattataCaught = other.SmallRattataCaught;
}
}
public void MergeFrom(pb::CodedInputStream input)
{
uint tag;
while ((tag = input.ReadTag()) != 0)
{
switch (tag)
{
default:
input.SkipLastField();
break;
case 8:
{
Level = input.ReadInt32();
break;
}
case 16:
{
Experience = input.ReadInt64();
break;
}
case 24:
{
PrevLevelXp = input.ReadInt64();
break;
}
case 32:
{
NextLevelXp = input.ReadInt64();
break;
}
case 45:
{
KmWalked = input.ReadFloat();
break;
}
case 48:
{
PokemonsEncountered = input.ReadInt32();
break;
}
case 56:
{
UniquePokedexEntries = input.ReadInt32();
break;
}
case 64:
{
PokemonsCaptured = input.ReadInt32();
break;
}
case 72:
{
Evolutions = input.ReadInt32();
break;
}
case 80:
{
PokeStopVisits = input.ReadInt32();
break;
}
case 88:
{
PokeballsThrown = input.ReadInt32();
break;
}
case 96:
{
EggsHatched = input.ReadInt32();
break;
}
case 104:
{
BigMagikarpCaught = input.ReadInt32();
break;
}
case 112:
{
BattleAttackWon = input.ReadInt32();
break;
}
case 120:
{
BattleAttackTotal = input.ReadInt32();
break;
}
case 128:
{
BattleDefendedWon = input.ReadInt32();
break;
}
case 136:
{
BattleTrainingWon = input.ReadInt32();
break;
}
case 144:
{
BattleTrainingTotal = input.ReadInt32();
break;
}
case 152:
{
PrestigeRaisedTotal = input.ReadInt32();
break;
}
case 160:
{
PrestigeDroppedTotal = input.ReadInt32();
break;
}
case 168:
{
PokemonDeployed = input.ReadInt32();
break;
}
case 178:
{
PokemonCaughtByType = input.ReadBytes();
break;
}
case 184:
{
SmallRattataCaught = input.ReadInt32();
break;
}
}
}
}
public override bool Equals(object other)
{
return Equals(other as PlayerStats);
}
public override int GetHashCode()
{
var hash = 1;
if (Level != 0) hash ^= Level.GetHashCode();
if (Experience != 0L) hash ^= Experience.GetHashCode();
if (PrevLevelXp != 0L) hash ^= PrevLevelXp.GetHashCode();
if (NextLevelXp != 0L) hash ^= NextLevelXp.GetHashCode();
if (KmWalked != 0F) hash ^= KmWalked.GetHashCode();
if (PokemonsEncountered != 0) hash ^= PokemonsEncountered.GetHashCode();
if (UniquePokedexEntries != 0) hash ^= UniquePokedexEntries.GetHashCode();
if (PokemonsCaptured != 0) hash ^= PokemonsCaptured.GetHashCode();
if (Evolutions != 0) hash ^= Evolutions.GetHashCode();
if (PokeStopVisits != 0) hash ^= PokeStopVisits.GetHashCode();
if (PokeballsThrown != 0) hash ^= PokeballsThrown.GetHashCode();
if (EggsHatched != 0) hash ^= EggsHatched.GetHashCode();
if (BigMagikarpCaught != 0) hash ^= BigMagikarpCaught.GetHashCode();
if (BattleAttackWon != 0) hash ^= BattleAttackWon.GetHashCode();
if (BattleAttackTotal != 0) hash ^= BattleAttackTotal.GetHashCode();
if (BattleDefendedWon != 0) hash ^= BattleDefendedWon.GetHashCode();
if (BattleTrainingWon != 0) hash ^= BattleTrainingWon.GetHashCode();
if (BattleTrainingTotal != 0) hash ^= BattleTrainingTotal.GetHashCode();
if (PrestigeRaisedTotal != 0) hash ^= PrestigeRaisedTotal.GetHashCode();
if (PrestigeDroppedTotal != 0) hash ^= PrestigeDroppedTotal.GetHashCode();
if (PokemonDeployed != 0) hash ^= PokemonDeployed.GetHashCode();
if (PokemonCaughtByType.Length != 0) hash ^= PokemonCaughtByType.GetHashCode();
if (SmallRattataCaught != 0) hash ^= SmallRattataCaught.GetHashCode();
return hash;
}
partial void OnConstruction();
public override string ToString()
{
return pb::JsonFormatter.ToDiagnosticString(this);
}
}
You can't see methods in the Auto and Locals View. Methods can have side effects when they get evaluated (properties are ought to have no side effects), so to prevent your application to end up corrupted it doesn't show them.
Only properties and fields are shown. You can call methods yourself in the Watch View.

Categories