This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void drawSelection(Canvas canvas, int startChar, int endChar, int line) { | |
Rect rect = getTextRect(line); | |
float startX = layout.getPrimaryHorizontal(startChar ); | |
float endX = 0; | |
int maxPosLine = layout.getLineEnd(line); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IPAddress ip = new IPAddress(new byte[] { 127, 0, 0, 1 }); | |
IPAddress ip = IPAddress.Parse("127.0.0.1"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IPAddress ip = IPAddress.Parse("127.0.0.1"); | |
IPEndPoint iEp = new IPEndPoint(ip, 12345); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Socket socket = new Socket(AddressFamily.InterNetwork,SocketType.Stream, ProtocolType.Tcp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Point | |
{ | |
private int x, y; // private fields | |
public Point (int x, int y) // constructor | |
{ | |
this.x = x; | |
this.y = y; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Point p1 = new Point(); // Point is a *struct* | |
Form f1 = new Form(); // Form is a *class* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Form f1; // Allocate the reference | |
f1 = new Form(); // Allocate the object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Point myPoint = new Point (0, 0); // a new value-type variable | |
Form myForm = new Form(); // a new reference-type variable | |
Test (myPoint, myForm); // Test is a method defined below | |
void Test (Point p, Form f) | |
{ | |
p.X = 100; // No effect on MyPoint since p is a copy | |
f.Text = "Hello, World!"; // This will change myForm’s caption since | |
// myForm and f point to the same object | |
f = null; // No effect on myForm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Point myPoint = new Point (0, 0); // a new value-type variable | |
Form myForm = new Form(); // a new reference-type variable | |
Test (ref myPoint, ref myForm); // pass myPoint and myForm by reference | |
void Test (ref Point p, ref Form f) | |
{ | |
p.X = 100; // This will change myPoint’s position | |
f.Text = “Hello, World!”; // This will change MyForm’s caption | |
f = null; // This will nuke the myForm variable! | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Point p2 = p1; | |
Form f2 = f1; |
OlderNewer